MATLAB: Str2num error

str2num

I am getting the following error:
Input argument "s" is undefined.
Error in ==> str2num at 32
if ~ischar(s) || ndims(s)>2
Here is the portion of the code:
function [x,ok] = str2num(s)
if ~ischar(s) || ndims(s)>2
error('MATALAB:str2num:InvalidArgument','Requires string or character array input.')
end
if isempty(s)
x = [];
ok=false;
return
end
Anyone know what this might mean?

Best Answer

If you run it with the following command
str2num
you will get this error. Try
str2num('2')
I am assuming that you saved str2num in a file str2num.m. Do you know that MATLAB has a builtin function str2num?