isnatural.m 424 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
function result = isnatural(a)
%returns true of the number in a is natural, false if not.

% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved. 
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. 
% </ITA-Toolbox>

try
    if a == round(double(a))
        result = true;
    else
        result = false;
    end
catch %#ok<CTCH>
    result = false;
end
end