필터 지우기
필터 지우기

Store directory listing into loopable structure

조회 수: 2 (최근 30일)
Deepayan Bhadra
Deepayan Bhadra 2022년 1월 27일
편집: Stephen23 2022년 1월 27일
Hello,
I am trying to collect the output of dir below into a folder/dataset/structure that I can loop through.
cd 'C:\Users\dbhadra\Desktop\MSD\Sensor Mixing\Pr14 Ryan Data\TC2\RT\Closed_Loop'
dir **/*RT06*.dat
The command line looks like
Files Found in: 211204-022539
2021-12-04T022539+0100_RT06_000_TC1.dat
Files Found in: 211204-022844
2021-12-04T022844+0100_RT06_000_TC1.dat
Files Found in: 211204-023148
2021-12-04T023148+0100_RT06_000_TC1.dat
How do I collect these files into one structure that I can loop through?

채택된 답변

Stephen23
Stephen23 2022년 1월 27일
편집: Stephen23 2022년 1월 27일
The MATLAB approach:
P = 'C:\Users\dbhadra\Desktop\MSD\Sensor Mixing\Pr14 Ryan Data\TC2\RT\Closed_Loop';
S = dir(fullfile(P,'**','*RT06*.dat'))
S will be a structure of filenames and other file information.
In general you should avoid command sytnax like you used, and prefer using function syntax like I showed:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by