Borrar filtros
Borrar filtros

Extracting multiple data files using a loop for each filename

3 visualizaciones (últimos 30 días)
Bill
Bill el 7 de Oct. de 2014
Comentada: Image Analyst el 7 de Oct. de 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

Respuestas (1)

Image Analyst
Image Analyst el 7 de Oct. de 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 comentario
Image Analyst
Image Analyst el 7 de Oct. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by