By 'script', I mean an m-file run from Windows with
> matlab -automation -r mymfile
The issue is that I would like to pass a parameter to
mymfile - which is then more appropriately called
function - but the syntax above apparently doesn't let me
to.
"Dimitri Shvorob" <not.dimitri.shvorob@gmail.com> wrote in
message <fv48vd$ag4$1@fred.mathworks.com>...
> By 'script', I mean an m-file run from Windows with
>
> > matlab -automation -r mymfile
>
> The issue is that I would like to pass a parameter to
> mymfile - which is then more appropriately called
> function - but the syntax above apparently doesn't let me
> to.
>
> Can anyone offer advice?
>
> Thanks!
Assuming you need a parameter A in your script MyScript.m,
you can use
"Jos " <DELjos@jasenDEL.nl> wrote in message <fv4euh$9e4
$1@fred.mathworks.com>...
> "Dimitri Shvorob" <not.dimitri.shvorob@gmail.com> wrote
in
> message <fv48vd$ag4$1@fred.mathworks.com>...
> > By 'script', I mean an m-file run from Windows with
> >
> > > matlab -automation -r mymfile
> >
> > The issue is that I would like to pass a parameter to
> > mymfile - which is then more appropriately called
> > function - but the syntax above apparently doesn't let
me
> > to.
> >
> > Can anyone offer advice?
> >
> > Thanks!
>
> Assuming you need a parameter A in your script
MyScript.m,
> you can use
>
> matlab -r "A=3;MyScript"
>
> hth
> Jos
>
>
or make MyScript a function accepting a parameter and call
it like
>The system could not find the environment option that was
>entered.
>test2(3) was unexpected at this time.
Try quoting the argument. I don't recognize any shell that would
give the message you got, so I don't know what system you are using.
Unix systems:
matlab -r 'test2(3)'
Windows:
matlab -r "test2(3)"
If I understand correctly, you have to use the double-quotes in Windows.
In Unix you could use either single or double quotes. Using double quotes
will give you problems if you have any $ in your argument. Using
single quotes will give you problems if you have any single-quotes
in your argument.
--
"I feel sorry for the person who can't get genuinely excited
about his work. Not only will he never be satisfied, but he will
never achieve anything worthwhile." -- Walter Chrysler
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Disclaimer prior to use.