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!

采纳的回答

Guillaume
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 CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by