[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: calling function with input arguments from commandline
From: |
Mike Miller |
Subject: |
Re: calling function with input arguments from commandline |
Date: |
Fri, 21 Oct 2005 08:54:02 -0500 (CDT) |
On Fri, 21 Oct 2005, Martina Labahn wrote:
I want to use the commandline to call the program octave + a function.
The "octave -- funcall FUNCTION" option doesn't work because my function
needs an input argument. The goal is to call this function from java.
Therefore the restriction to a call from the commandline. The input
argument is a file that should be loaded during the function.
I don't know if this will help, but did you know that you can write an
octave script that will read command line arguments? An Octave script is
an executable text file with this as the first line:
#!/usr/local/bin/octave -q
The "-q" is not needed but it suppresses the initial text output (version,
license, etc.). Of course, if octave isn't in /usr/local, you'd have to
change the path.
Then you can just write octave commands into the script. I did this to
load a file in an old version of Octave:
load(deblank(argv(1,:)))
I think the argv syntax has changed to use cell arrays in newer versions
of Octave. In Octave "help argv" will give you some suggestions.
Mike
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------