CO2gui - lab control and automation
06 Jan 2010
01 Apr 2014)
Software used for controlling and data logging lab equipment.
function response = isalogical(number)
% ISALOGICAL tests for if it can be used in an if statement or not.
% Deliberately not designed with recursion for cell arrays since these are
% not logical.
% checks the number of arguments
error(nargchk(1, 1, nargin))
% if its empty, it can't be used
% not valid
response = false;
% checks the number some more
response = isreal(number) & ~isnan(number) & isfinite(number);
elseif ischar(number) || islogical(number)
% this is OK too
response = true(size(number));
% not defined for anything else
response = false(size(number));