On Sun, May 07, 2006 at 07:04:43PM -0500, Quentin Spencer wrote:
Myriam Abramson wrote:
How do I load a file with a variable name?
octave> mypattern
mypattern = random4.out
octave> mypattern
mypattern = random4.out
octave> load mypattern
error: load: couldn't open input file `mypattern'
octave> load "mypattern"
error: load: couldn't open input file `mypattern'
octave>
A useful trick is to build command lines from strings. For example,
if you have
x = "1"
filename = "myfile"
you can do
exec(["load(", filename, x, ".dat)"])
which will execute
load(myfile1.dat)