Code covered by the BSD License  

Highlights from
Thar ABPR-20 RS232 communication via handheld emulation

Thar ABPR-20 RS232 communication via handheld emulation

by

 

20 May 2013 (Updated )

Controls and reads from a Thar ABPR-20, by emulating the handheld controller.

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