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.

isfid(fid)
function response = isfid(fid)
% ISFID says if file IDs are valid or not

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

% it must be not empty and a double
if ~isempty(fid) && isa(fid, 'double')
    % checks the fids more thoroughly
    response = ismember(fid, fopen('all'));

elseif iscell(fid)
    % call this recursively
    response = cellfun(@isfid, fid, 'UniformOutput', false);
    
elseif isstruct(fid)
    % errors and not defined for it
    error('Not defined for structures.')
    
else
    % otherwise it must be invalid
    response = false(size(fid));
end

Contact us