Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation



06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

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.')

% different tests for different types
if iscell(timerObject)
    % recursively call this function
    response = cellfun(@istimer, timerObject, 'UniformOutput', false);
    % 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);

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

Contact us