help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: self-contained Octave scripts


From: Kai Habel
Subject: Re: self-contained Octave scripts
Date: Fri, 04 Aug 2000 16:56:31 +0200

Paolo schrieb:
> 
> i've written my octave scripts and now i'd like to make them executable,
> i've some problem. Reading the manual
> i can't compile the second example, and i don't understand something:
> in my files.m there 10 functions, one load the file.dat the other make
> histo, one compute the atocorrelation and so on ... to make these
> function executable i've to split every funcion in a different script
> file ? and how can i pass it my arguments (argv ?) ? for example the
> function that load the file is:

First, make sure that your scripts works within octave. So all your
functions must reside in its own files. These files must be in octave's 
LOADPATH.
Make a wrapper script which calls your functions.
The arguments a stored in argv variable.

Here an example script file (foo.m) :

-------------------------
#!/usr/local/bin/octave -q

if (rows(argv) < 1)
        usage("foo filename");
else
        fname = argv(1,:);
        if (isstr(fname))
                ret = your_octave_function(fname);
                next_fun(ret);
                hist();
                .....
        endif
endif

-------------------------

make foo.m executable: chmod +x foo.m

now

./foo.m /path/yourfile

should work


Hope this helps

Bye Kai



-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]