Path: news.mathworks.com!not-for-mail
From: "J Bell" <superblindman@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: undefined variable error message
Date: Tue, 23 Mar 2010 01:13:05 +0000 (UTC)
Organization: BYU
Lines: 56
Message-ID: <ho94j1$6ct$1@fred.mathworks.com>
References: <ho91ju$mhg$1@fred.mathworks.com> <ho922l$t30$1@fred.mathworks.com> <cd8c0f96-ec6b-47bc-8c0c-2d8b4dd441cb@d30g2000prn.googlegroups.com>
Reply-To: "J Bell" <superblindman@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1269306785 6557 172.30.248.38 (23 Mar 2010 01:13:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 23 Mar 2010 01:13:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2279163
Xref: news.mathworks.com comp.soft-sys.matlab:619206

Nathan <ngreco32@gmail.com> wrote in message <cd8c0f96-ec6b-47bc-8c0c-2d8b4dd441cb@d30g2000prn.googlegroups.com>...
> On Mar 22, 5:38 pm, "J Bell" <superblind...@gmail.com> wrote:
> > "Oleg Komarov" <oleg.komarovRemove.t...@hotmail.it> wrote in message <ho922l$t3...@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?
> 
> That is the problem.
> 
> What value would you expect to be in Y, X, or beta, if you don't tell
> the program what values they are supposed to be?
> 
> If that is the extent of your function, try typing this in the matlab
> command window:
> %arbitrary data values:
> Y = 5;
> beta = .01;
> X = 4;
> %function call
> dumb(beta,Y,X)
> 
> 
> -Nathan

I made this very cumbersome by not including the other code, that which defines the variables, sorry, here it is:

beta=[1;0];
X=[ones(N,1) rand(N,1)];
    mu=randn(N,1);
    Y=X*beta+mu;

So Y is defined here.  I should have included this before, sorry.
So the variable "Y" appears in the workspace with the value listed as "<500x1 double>"

After running this in the command window, I still get the error message.