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?

 채택된 답변

Andrew Newell
Andrew Newell 2012년 1월 23일

1 개 추천

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?

댓글 수: 3

Duch
Duch 2012년 2월 3일
Thanks for the quick response. Just seeing it now. I guess it would help if I elaborated on the error. So the error refers to line in my code, however the line in my code refers to the builtin MATLAB Function.
So here is the error I am getting...
Input argument "s" is undefined.
Error in ==> str2num at 32
if ~ischar(s) || ndims(s)>2
Error in ==> EFT at 147
blockNum = str2num(n.block);
Here is the line in my program "EFT"
blockNum = str2num(n.block);
Here are the lines in MATLAB's str2num
if ~ischar(s) || ndims(s)>2
error('MATALAB:str2num:InvalidArgument','Requires string or character array input.')
end
Walter Roberson
Walter Roberson 2012년 2월 3일
If you put a breakpoint in at that line in your EFT function, then what value and size() and class() does it say n.block is? And if you "step into" the function call and examine s inside, what is it there?
Please use
which -all str2num
to find out whether you somehow have your own str2num.
Duch
Duch 2012년 2월 4일
Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기

태그

질문:

2012년 1월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by