How to load files on a loop
Mostrar comentarios más antiguos
I'm trying to load files named as 'x.0020.FIT'....'x.0021.FIT' etc., and there are around 1000 files.
I used
a = fitsread('x.0020.FIT')
which imports one file at a time, each with a different variable. Is it possible to do this on a loop?
Respuestas (1)
David Hill
el 8 de Dic. de 2020
f=20:1020;
for k=1:length(f)
fileName=sprintf('x.%04d.FIT',f(k));
a{k}=fitsread(fileName);
end
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!