Determine if a string is numeric: Difference between revisions

→‎{{header|MATLAB}}: simplify matlab code
m (added related tasks.)
(→‎{{header|MATLAB}}: simplify matlab code)
Line 2,336:
=={{header|MATLAB}}==
<lang MATLAB>
function r = isnum(a)
% copy from Octave version on this page
function r = isnum~isnan(str2double(a))
end
if ( isnumeric(a) )
r = 1;
else
o = str2num(a);
r = !isempty(o);
endif
end
 
% tests
Anonymous user