Read Multiple Files with While Loop
2 次查看(过去 30 天)
显示 更早的评论
I have about 20 files that I need to read and manipualte data. How would I write a while loop so that it will read the file, extract data, then continue to read the next file, etc. ?
2 个评论
Stephen23
2022-9-20
"How would I write a while loop so that it will read the file, extract data, then continue to read the next file, etc. ?"
The standard approach is to use a FOR loop:
回答(1 个)
Chunru
2022-9-20
fn = dir("*.dat"); % or your file name pattern
for i=1:length(fn)
fn_c = fn(i).name % current filename to be processed
% do processing for fn_c
end
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!