Creating a loop in order to read .txt files

4 ビュー (過去 30 日間)
Ivan Mich
Ivan Mich 2019 年 9 月 26 日
コメント済み: KALYAN ACHARJYA 2019 年 9 月 26 日
Hello,
I have files like these: A_ac_s001.txt , A_ac_s002.txt, A_ac_s003.txt ,..., A_ac_s100.txt
I would like to create a loop which will read 'one to one' each file. Does anyone knows which command should I use?

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 26 日
list=dir('*.txt');
for j=1:length(list)
file_text=textread(list(j).name);
%.....code
end
  6 件のコメント
Stephen23
Stephen23 2019 年 9 月 26 日
"I meant that finally i would like to create 2 loops..."
So create two loops:
S = dir('A_ac*.txt');
for k = 1:numel(S)
S(k).name
end
S = dir('A_bb*.txt');
for k = 1:numel(S)
S(k).name
end
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 26 日
Thanks @Stephen

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by