On 8 January 2013 12:54, RC Crozier <address@hidden> wrote:
Quoting Jordi Gutiérrez Hermoso <address@hidden> on Tue, 8 Jan 2013
12:35:44 -0500:
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
Sorry I sent some nonsense in the last email I meant:
bash-4.1$ cat ./temp/lol.m
#! /home/s0237326/bin/share/bin/octave -qf
x = which(mfilename)
whos x
disp(which(mfilename))
which won't give you a directory. How about regexping it instead?
cd(regexprep(mfilename("fullpath"), "[^/]*$", ""))
HTH,
- Jordi G. H.