On 8 January 2013 11:09, Richard Crozier <address@hidden> wrote:
I'm trying out running an octave script as an executeable program
(http://sunsite.univie.ac.at/textbooks/octave/octave_3.html#SEC39)
is there any way for octave running this way to get the location of
the running script? I want it to be able to locate other function
files from the script location (actually I just want to cd to the
script location, knowing the other function files are located there
too), but mfilename() returns an empty string. I'm guession this is
because this is not actually treated as a script file, but as a
series of commands to the interpreter.
WFM, what OS are you using and what Octave version?
address@hidden:~$ ./lol.m
ans = lol
ans = /home/jordi/lol
ans = /home/jordi/lol.m
address@hidden:~$ cat lol.m
#!/usr/local/bin/octave -q
mfilename
mfilename fullpath
mfilename fullpathext
- Jordi G. H.