help-octave
[Top][All Lists]
Advanced

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

Re: reading multiple file


From: Carlo de Falco
Subject: Re: reading multiple file
Date: Tue, 28 Jul 2009 15:12:42 +0200


On 28 Jul 2009, at 10:56, nuncio murukesh wrote:

Hi all,
       I am new to octave and started learning it to interpolate some
ocean profile data using spline.  The problem is that I have quite a
number of files, say, 10000 all of which needed to be opened and
interpolate.  If I have file names like file_1.txt,
file_2.txt......file_n.txt, can all the files be opened using the for
loop something like this
for i=1,10000
        filename="file_"+i+".txt"
        endfor

In Octave a string is just a vector of characters so you can do

for i=1:10000
  filename= [ "file_" num2str(i) ".txt" ];
endfor

or you can do it in C style

for i=1:10000
  filename= sprintf("file_%d.txt", i);
endfor

        I took this idea from IDL
anyother means would also be greatly appreciated

Thanks
--
Polar Remote Sensing Division
NCAOR

c.



reply via email to

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