[Top][All Lists]

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

loading multiple datafile

From: baptiste auguie
Subject: loading multiple datafile
Date: Fri, 3 Nov 2006 16:01:12 +0000


A newbie question: I have these datafiles "datafile1.dat", "datafile2.dat",... "datafile347.dat", which I want to load and use in Octave (e.g, to plot some data as shown below). For one single datafile, I would do,

load     datafile1.dat

x1= datafile1(:,1);y1=  datafile_1(:,3);

__gnuplot_set__  term aqua
__gnuplot_set__  title "title"
__gnuplot_set__  xlabel 'Wavelength (nm)'
__gnuplot_set__  ylabel 'Transmission (a.u.)'


and the result is fine. But I can't figure out a way of dealing with many files. Obviously, I can duplicate the lines and change the filename, but it's not an option with lots of files. I tried something like:

load *.dat


load [a-b].dat

without any success.

In Matlab, which I'm more familiar with, I'd do something like,

tab_i=[1: 2]; %filenames numbers of interest
for i=1:length(tab_i)
filenames{i}=['data' num2str(i) '.dat']; % string array of filenames
dataCollect.value{i}=load(filenames{i}); %
hold on

hold off

(probably a weird way to do it, anyway...)

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

Many thanks,

All the best


reply via email to

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