Sequencing data in the loop (*.CSV files)
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
the sequence of Output is not ok. How can I keep the data in sequnce. Kindly advise what I am missing ?
*.CSV files are like "D1.CSV, D2.CSV, D3.CSV............................D35.CSV"
The output file is not following this sequence.
files = dir('Data\*.CSV') ;
%files = natsortfiles({files.name}); %natsortfiles external Add In
N = length(files) ;
Output = cell(N,1) ;
for i = 1:N
Output{i} = readmatrix(files(i).name) ;
end
Advise please.
0 件のコメント
採用された回答
Stephen23
2024 年 3 月 12 日
移動済み: Stephen23
2024 年 3 月 12 日
"How can I keep the data in sequnce."
Either use sufficient leading zeros in the filenames OR sort the filenames alphanumerically.
Kindly advise what I am missing ?"
files = dir('Data\*.CSV');
files = natsortfiles(files); % <- this
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!