Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

fibreobjwriteaverages(serialObject, averages)
function fibreobjwriteaverages(serialObject, averages)
% FIBREOBJWRITEAVERAGES writes the number of averages to the FOR
% fibreobjwriteaverages(serialObject, averages) writes the specified number of
% averages to the FOR, and must be a scalar integer from 10 to 10000
% (although actually the hardware limitations are not known).


% checks the number of arguments
error(nargchk(2, 2, nargin))

% checks the averages
if ~isnumeric(averages) || ~isscalar(averages) || ~isreal(averages) || isnan(averages) || averages < 10 || averages > 10000 || averages ~= round(averages)
    % errors
    error('The number of averages must be a scalar integer from 10 to 10000.')
end

% checks its not broadcasting
if fibreobjstatus(serialObject)
    % error
    error('FOR must not be broadcasting to write the averages.')
end

% writes the parameter
try
    % sends it
    fibreobjcomm('write', serialObject, 0, 2, averages)

    % if it got this far, then store it in user data
    serialObject.UserData.averages = averages;

catch
    % errors
    error('Could not change the number of averages.')
end

Contact us