Prev: mex command
Next: Hessian matrix for Image Analysis
From: Sadik on 22 Mar 2010 21:39 By the way, there are good questions to you by Nathan here: http://www.mathworks.com/matlabcentral/newsreader/view_thread/277182 Once you answer them, the issue will probably be resolved.
From: J Bell on 23 Mar 2010 01:37 "Sadik " <sadik.hava(a)gmail.com> wrote in message <ho963p$sas$1(a)fred.mathworks.com>... > By the way, there are good questions to you by Nathan here: > > http://www.mathworks.com/matlabcentral/newsreader/view_thread/277182 > > Once you answer them, the issue will probably be resolved. Thanks, these posts have helped me to figure it out, especially reading the information about function syntax suggested by one of the people who posted. Thanks for the help. I have new questions about the project I'm doing but I think what I learned is the process of passing arguments from an m file to the workspace but using function syntax. I now need to learn if you can pass arguments from the workspace to an m file. No need to reply, I'll work on figuring it out, but if anyone knows I'll definitely read it. thanks again all
From: Herve on 23 Mar 2010 08:42
Nathan <ngreco32(a)gmail.com> wrote in message <902f0d33-e7cb-4e9d-9f87-a795207708c3(a)c20g2000prb.googlegroups.com>... > 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? You can only press the run command (the green triangle button) when your function has no input arguments... In you case, your function "dumb" has three arguments... Hence the error message. Go to the help and look at the page "Running M-Files in the Editor". If you want to use the command window > x = 1:10; > y = 2:11; > beta = 2; > dumb(beta,x,y) Your dumb function must be saved in a m-file called dumb.m Hope that helps ! |