From: Thusitha on
"David Young" <d.s.young.notthisbit(a)sussex.ac.uk> wrote in message <htqmp0$653$1(a)fred.mathworks.com>...
> "Thusitha " <tsliyan(a)hotmail.com> wrote in message <htqlsu$b5q$1(a)fred.mathworks.com>...
> > ... What I need is a link to the language reference relating to how Matlab handles input parameters when called from the command line.
>
> See my reply above.


Thanks David,

For some reason I missed your comment in between other comments.

That is all I wanted to know.
From: Steven Lord on

"Thusitha " <tsliyan(a)hotmail.com> wrote in message
news:htq1tj$cl9$1(a)fred.mathworks.com...
> Hi,
>
> I have a function like below
>
> function StylizedMMM(pT, pDelta, pAlpha, pEta, pDim, pPhiZero, pSeed)
>
>
> and I would like to run it using the command line.
>
> This is the way I run the above function
>
> StylizedMMM 80 0.004 0.04 0.05 4 2

When you call a function like this, you're calling it using "command form".
You _could_ call it that way, as long as you convert those strings into
numbers if that's what the rest of your code expects. That's not the
easiest of ways to call it, though -- I would call it using "functional
form".

StylizedMMM(80, 0.004, 0.04, 0.05, 4, 2)

The line of code you wrote above in command form is equivalent to the
following functional form:

StylizedMMM('80','0.004','0.04','0.05','4','2')

The fact that you can call functions in two different ways is called
"command-function duality".

> When I do this, do I need to use do the following?
>
> T = str2double(pT)
> delta = str2double(pDelta)
> alpha = str2double(pAlpha)
> eta = str2double(pEta) dim = str2double(pDim)

If your function expects its inputs to be numeric and you call it using
command form, yes. If your function is okay working on char arrays or you
call it using function form (passing the numbers rather than their string
representation) no.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com