フィルターのクリア

Read Multiple Files with While Loop

1 回表示 (過去 30 日間)
Daniella Chait
Daniella Chait 2022 年 9 月 20 日
コメント済み: Stephen23 2022 年 9 月 20 日
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 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 20 日
Is there a particular reason to use a while loop instead of a for loop?
Stephen23
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
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

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by