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 6, 2013 8:41 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Moon Datta" wrote in message <ketecv$gto$1@newscl01ah.mathworks.com>...
> "James Tursa" wrote in message <kesuq8$o6r$1@newscl01ah.mathworks.com>...
> > "Moon Datta" wrote in message <kesr9o$clj$1@newscl01ah.mathworks.com>...
> > >
> > > Sir,
> > > the m file is a function.

> >
> > Please post your function.
> >
> > James Tursa

>
> sir,
> the function is
>
> function [P,f,alpha] = lomb(x,t,varargin)
>
>
> x and t are the variables that are present in the workspace. but
>
> if nargin < 2, error('%s: there must be at least 2 inputs.',mfilename); end
>
>
> but error is still coming.
>
>
> regards
> Moon


Note that the function cannot see variables in the workspace. You have to pass them to the function using function arguments. You should call the function like this from the command prompt:
>> lomb(A,B)
where A and B are the names of variables in your workspace. (In your case, it is a little confusing because the names used in the function are the same as the names of the variables outside the function.)

I suspect call this function from the prompt like this:
>> lomb

hth
~ 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.