Input argument in function undefined
Mostrar comentarios más antiguos
Whenever I run this code I get this error. The code is attached. The error is:
??? Input argument "sym" is undefined.
Error in ==> ARM_deco at 10 if(length(sym)==length(p) && sum(p)==1)
2 comentarios
Azzi Abdelmalek
el 1 de Nov. de 2014
Post the entire code
Utkarsh Singh
el 1 de Nov. de 2014
Respuestas (1)
Image Analyst
el 1 de Nov. de 2014
how did you call Arithmetic_dec(sym,p,tagword)? Did you just click on the green triangle, which doesn't supply any input arguments (I think this was most likely what you did), or did you give a bad value for sym, like
Arithmetic_dec([],1,'bombs')
5 comentarios
Utkarsh Singh
el 1 de Nov. de 2014
Editada: Utkarsh Singh
el 1 de Nov. de 2014
John D'Errico
el 1 de Nov. de 2014
No. In the example you give, sym will be defined, but empty.
And of course, it is a terrible idea to name a variable sym, a very useful tool in its own right.
Image Analyst
el 1 de Nov. de 2014
So when you clicked on the green triangle, exactly what values did you think the input arguments would take on??? You think it would just invent something that happened to be in the right range? No. You have to tell it. Look up varargin in the help if you want to check for variable number of inputs and assign defaults.
Utkarsh Singh
el 1 de Nov. de 2014
Image Analyst
el 1 de Nov. de 2014
Why don't you make a tests script to assign input variables and call this function? If you just want to click the green triangle, then don't have any arguments at all and just assign them inside the function. Or get rid of the function line and turn it into a simple script.
Categorías
Más información sobre Common Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!