Code covered by the BSD License  

Highlights from
Realterm communications suite

Realterm communications suite



06 Jan 2010 (Updated )

Use Realterm in a similar way to using the MATLAB "serial" commands and instrument control toolbox.

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.')
    % otherwise it must be invalid
    response = false(size(fid));

Contact us