Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: nargin
Replies: 7   Last Post: Feb 6, 2013 8:41 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jos

Posts: 1,266
Registered: 10/24/08
Re: nargin
Posted: Feb 5, 2013 6:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Moon Datta" wrote in message <keqqng$7g3$1@newscl01ah.mathworks.com>...
> "Jos (10584)" wrote in message <keqq8g$63l$1@newscl01ah.mathworks.com>...
> > "Moon Datta" wrote in message <keqp4p$2f9$1@newscl01ah.mathworks.com>...
> > > I am dealing with a m file whose first line is
> > >
> > > "if nargin < 2, error('%s: there must be at least 2 inputs.',mfilename); end"
> > >
> > > but when the program is running the it is giving the error
> > >
> > > "there must be at least 2 inputs".
> > >
> > > but there is already 5 inputs in the worksheet. I have tried a lot but not understanding properly the reason of error. any help from your side will be helpful to me.
> > >
> > > thanks in advance.

> >
> > nargin is useful inside functions (m-files of which the first non-comment is the word function). Since you say this line is the first line, I suppose you're dealing with a script, for which nargin returns 0, hence the error.
> >
> > I do not know what you mean by "5 inputs in the worksheet". Do you want to say you have 5 variables in your workspace? And that these 5 variables are the be used by the m-file?
> >
> > ~ Jos

>
> Thank you sir.
> yes I have 5 variables in my worksheet and they will be used by the function.


Is your m-file a function or a script? if it is a script you might want to comment out that line ...

~ Jos


Date Subject Author
2/5/13
Read nargin
Moon Datta
2/5/13
Read Re: nargin
Jos
2/5/13
Read Re: nargin
Moon Datta
2/5/13
Read Re: nargin
Jos
2/6/13
Read Re: nargin
Moon Datta
2/6/13
Read Re: nargin
James Tursa
2/6/13
Read Re: nargin
Moon Datta
2/6/13
Read Re: nargin
Jos

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.