Am Dienstag, 26. April 2011, 19:20:58 schrieb Daryl Lee:
I'm fairly new to Octave. I've figured out how to pass command-line
arguments to a script, but only if that script is an executable script or
called from the system command line, a la "$ octave myscript.m arg1 arg2".
Is there a way to do so from the Octave console? When I am at the Octave
prompt and type "myscript arg1 arg2" I get "error: invalid use of script in
index expression." I'm using Octave 3.2.4 on a Windows 7 64-bit laptop.
Here is the script that I have so far:
====================
% Display command line
printf('%s; %d arguments\n', program_name(), nargin);
arg_list = argv();
for i = 1:nargin
printf('%d argument = %s\n', i, arg_list{i});
endfor
printf('\n');
====================
I am really not sure if I understood what you want. But what about
system("octave myscript.m a b")
at the octave command prompt?