How to load files on a loop
显示 更早的评论
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?
回答(1 个)
David Hill
2020-12-8
f=20:1020;
for k=1:length(f)
fileName=sprintf('x.%04d.FIT',f(k));
a{k}=fitsread(fileName);
end
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!