Prev: mex command
Next: Hessian matrix for Image Analysis
From: J Bell on 22 Mar 2010 20:22 This is my code: function theVal = dumb(beta,Y,X) err=Y-X*beta; err=abs(err); theVal=sum(err); end when I run it, I get the message ??? Input argument "Y" is undefined. Error in ==> dumb at 3 err=Y-X*beta; any help? thanks why does this error message appear in general?
From: Nathan on 22 Mar 2010 20:25 On Mar 22, 5:22 pm, "J Bell" <superblind...(a)gmail.com> wrote: > This is my code: > > function theVal = dumb(beta,Y,X) > > err=Y-X*beta; > err=abs(err); > theVal=sum(err); > > end > > when I run it, I get the message > > ??? Input argument "Y" is undefined. > > Error in ==> dumb at 3 > err=Y-X*beta; > > any help? > > thanks > > why does this error message appear in general? How did you call the function? Did you try running it by pressing the green triangle button? Did you type the function name into the command window? Do you know that you need to pass in arguments in order for your function to work? -Nathan
From: Oleg Komarov on 22 Mar 2010 20:30 > when I run it, I get the message > > ??? Input argument "Y" is undefined. > > Error in ==> dumb at 3 > err=Y-X*beta; > > any help? > > thanks > > why does this error message appear in general? Be more precise, how do you run it? It appears whenewer you try to use a variable that doesn't exist yet in the workspace. An example: clear a = 1+c; Oleg
From: J Bell on 22 Mar 2010 20:38 "Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <ho922l$t30$1(a)fred.mathworks.com>... > > when I run it, I get the message > > > > ??? Input argument "Y" is undefined. > > > > Error in ==> dumb at 3 > > err=Y-X*beta; > > > > any help? > > > > thanks > > > > why does this error message appear in general? > > Be more precise, how do you run it? > > It appears whenewer you try to use a variable that doesn't exist yet in the workspace. > > An example: > clear > a = 1+c; > > Oleg I saved an m file with the name "dumb.m" containing this code, and in Matlab navigated to the location of this m file so that it appears in the "Current Directory" window. I run it by typing "dumb" and pressing enter in the command window. Perhaps this is the problem?
From: Matt Fig on 22 Mar 2010 20:38
"J Bell" <superblindman(a)gmail.com> wrote in message > ??? Input argument "Y" is undefined. > > Error in ==> dumb at 3 > err=Y-X*beta; > why does this error message appear in general? Shockingly, this error message, in general, means that one of the arguments the function is supposed to receive when called (known as an 'input' argument), has not been received. This leaves the argument 'undefined' within the workspace of the function. |