help-octave
[Top][All Lists]
Advanced

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

Re: loading multiple datafile


From: baptiste auguie
Subject: Re: loading multiple datafile
Date: Sat, 4 Nov 2006 13:23:14 +0000

Thanks, I agree this seems more versatile.

A related question: now that I load all these files, I can plot them in the loop using hold on, but I would rather save the filenames in some array of string, and plot outside the loop using this list. I'm not sure of the best way to handle this sort of things. Matlab provides some structures, cells, arrays, ... Octave probably does too, but which is more appropriate?

Thanks again,

baptiste



On 4 Nov 2006, at 12:05, Rafael Laboissiere wrote:

* Tom Holroyd (NIH/NIMH) [E] <address@hidden> [2006-11-03 12:23]:

s = ["file", num2str(i), ".dat"]
load(s);

baptiste auguie wrote:
With Octave's load function, I can't seem to pass a filename I've
constructed automatically. What would you suggest?


I much prefer this:

   s = sprintf ("file%d.dat", i);
   load (s);

Using sprintf allows me to do more powerful things as this:

   s = sprintf ("file%03d.dat", i);

and then access files with names file001.dat, file002.dat, ..., file037.dat,
etc.

--
Rafael



reply via email to

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