I would like to store files in an array of type A(10,1:853,1:853) using csvread and a for loop. How can I do this?
2 次查看(过去 30 天)
显示 更早的评论
My csv files are spectra data of the type A1a(1:853,1:853). Column 1 contains wavelength information, Column 2 contains intensity information. I have multiple csv files in a folder, A1a, A1b, A1c.....A1k.csv I would like to store these files in an array of type A(10,1:853,1:853) using csvread and a for loop. How can I do this? Thank You!
0 个评论
采纳的回答
Guillaume
2015-10-7
Assuming all your csv files have exactly the same number of elements:
finalletters = 'a':'k';
A = zeros(numel(finalletters), 853, 853);
for letteridx = 1:numel(finalletters)
A(letteridx, :, :) = csvread(sprintf('A1%c.csv', finalletters(letteridx)));
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!