Azzera filtri
Azzera filtri

Extracting multiple data files using a loop for each filename

1 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

Image Analyst
Image Analyst il 7 Ott 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 Commento
Image Analyst
Image Analyst il 7 Ott 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.

Accedi per commentare.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by