[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parameters to executable Octave programs
From: |
John W. Eaton |
Subject: |
Parameters to executable Octave programs |
Date: |
Wed, 6 Mar 1996 00:55:03 -0600 |
Matthias Roessler <address@hidden> wrote:
: As described in section "1.3 Executable Octave Programs" I made my
: octave programs executable. How do I pass parameters from the command
: line to my program? I would like to do something like this:
:
: #!/local/octave/bin/octave -qf
:
: temperature = $1;
: pressure = $2;
: epsilon = $3;
:
: result = Start_my_calculation_with(temperature, pressure, epsilon);
It isn't possible to do this directly with released versions of
Octave, but it works in my current sources and will be in the next
release:
$ cat print-args
#! /usr/local/octave-ss/bin/octave -qf
printf ("%s\n%s\n", program_invocation_name, program_name);
for i = 1:nargin
printf ("arg #%d: %s\n", i, argv(i,:));
end
$ ./print-args foo bar baz
./print-args
print-args
arg #1: foo
arg #2: bar
arg #3: baz
Thanks,
jwe