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.

istimer(timerObject)
function response = istimer(timerObject)
% ISTIMER checks if an object is a valid timer object

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

% if its a structure, error
if isstruct(timerObject)
    % errors
    error('Not defined for structures.')
end

% different tests for different types
if iscell(timerObject)
    % recursively call this function
    response = cellfun(@istimer, timerObject, 'UniformOutput', false);
    
else
    % checks the object
    response = isa(timerObject, 'timer');
    
    % if it is a timer...
    if response
        % checks the timer objects for validity - isvalid only works on
        % vectors, but the timer class does not allow arrays of timers so
        % we don't need to check this
        response = isvalid(timerObject);

    else
        % generates a false response the same size as the timerObject
        response = false(size(timerObject));
    end
end

Contact us