Filtering txt files out structs and assign to subfolder

2 ビュー (過去 30 日間)
Bas Bloemendaal
Bas Bloemendaal 2021 年 11 月 24 日
Hi There,
I was trying to filter out the 'CAp_*.txt' files and assign it to the last subfolder, but did not succeed. How can I do this?
Kind Regards,
  1 件のコメント
Bas Bloemendaal
Bas Bloemendaal 2021 年 11 月 24 日
Found out how to filter on ' CAd':
filtered_struct = directory_text{1,1}(startsWith({directory_text{1,1}.name}, 'CAd'));
However, I cannot assign it to the last subfolder where eacht .txt belongs to.

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

回答 (1 件)

Shravan Kumar Vankaramoni
Shravan Kumar Vankaramoni 2021 年 12 月 9 日
Hi,
You can simply use the below code to filter out the files
files = dir(CAp_*.txt) % This will give all the .txt files starting with CAp_
To copy files to a subfolder, refer the below answer:

カテゴリ

Find more on Structures in Help Center and File Exchange

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by