[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: command-line like arguments at the octave prompt?
From: |
CdeMills |
Subject: |
Re: command-line like arguments at the octave prompt? |
Date: |
Mon, 30 Aug 2010 00:53:35 -0700 (PDT) |
Mike B.-2 wrote:
>
> The octave manual mentions it is possible to provide command line
> arguments at the shell prompt, for example:
> octave myfile.m a b c
>
> Is it possible to do the same for a script (not a function) at the octave
> prompt, for example:
>
> 1:>myfile a b c
>
>
A script is a collection of octave commands, and as such does not have
arguments. May be you're thinking about functions that may be encountered
under two forms:
hold on
hold('on')
This result can be achieved by:
function resu = myfunc(varargin)
resu = varargin;
endfunction
which can be used as
myfunc string1 string2
or
myfunc('string1', 'string2')
The drawback is that, in the first case, the arguments are passed as string:
x=randn(1)
myfunc x
receives the string 'x', not the content of the variable x.
Regards
Pascal
--
View this message in context:
http://octave.1599824.n4.nabble.com/command-line-like-arguments-at-the-octave-prompt-tp2399458p2399697.html
Sent from the Octave - General mailing list archive at Nabble.com.