multiple folder paths into a loop

Hello friends,
In the attached Test.zip floder, there are txt files at each end folder ( \B1\sss\ttt ). There are only 4 files (B1-B4) attached here, but I have 32 of those. I need to do a same operation to each txt file at all 4 main folders. How can I include those folder paths into a loop to do the same operation to each txt file.
Hope you can help with this.
Thank you

4 件のコメント

Walter Roberson
Walter Roberson 2020 年 2 月 17 日
dir('B*\sss\ttt')
and use the folder property of the entry to find out which directory it came from.
Binu
Binu 2020 年 2 月 18 日
Hi Walter,
Thanks. It worked, but the structure came like the image below.
How can I select only the *.txt files.
Thanks
Hyeokjin Jho
Hyeokjin Jho 2020 年 2 月 18 日
dir('B*\sss\ttt\*.txt')
Binu
Binu 2020 年 2 月 18 日
Thanks Hyeokjin

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

 採用された回答

Joseph Cheng
Joseph Cheng 2020 年 2 月 18 日
編集済み: Joseph Cheng 2020 年 2 月 18 日

0 投票

to add onto what Mr. Roberson has up there:
[a]=dir('B*\sss\ttt\*.txt')
you can continue the search by using the wildcard + extension

1 件のコメント

Binu
Binu 2020 年 2 月 18 日
Thanks Joseph

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2020 年 2 月 17 日

コメント済み:

2020 年 2 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by