Extracting multiple data files using a loop for each filename

1 Ansicht (letzte 30 Tage)
Bill
Bill am 7 Okt. 2014
Kommentiert: Image Analyst am 7 Okt. 2014
Hi, I am trying to extract data using the abfload function. I have multiple sets of data say: A1.abf, B2.abf, C3.abf etc and I want to extract them, plot and save these plots. I can easily just do:
if true
abfload(A1.abf)
fnam=[fstring, 'szfcsa.eps'];
figure;
plot(A1);
saveas(gcf,['C:blahblah,filesep,fnam],'eps');
end
(where I define the strings earlier) Is there someway of doing all of this in a loop? When i try:
if true
for i = {'A1.abf','B2.abf','C3.abf'}
abfload(i);
figure;
plot(i);
end
end
I get errors, I am also unsure how i would go about saving these plots

Antworten (1)

Image Analyst
Image Analyst am 7 Okt. 2014
This question is asked a lot , probably more than any other question. See the FAQ for code samples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
  1 Kommentar
Image Analyst
Image Analyst am 7 Okt. 2014
Did you see the second code example there? You can use dir() to put in any file pattern you want, for example dir('*.abf'). You can sort what you get back if you want, or take it just as the operating system gives it to you.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by