From: J Bell on
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
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
> 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
"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
"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.
 |  Next  |  Last
Pages: 1 2 3
Prev: mex command
Next: Hessian matrix for Image Analysis