Filtering txt files out structs and assign to subfolder

조회 수: 1 (최근 30일)
Bas Bloemendaal
Bas Bloemendaal 2021년 11월 24일
답변: Shravan Kumar Vankaramoni 2021년 12월 9일
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:

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by