Effacer les filtres
Effacer les filtres

Store directory listing into loopable structure

2 vues (au cours des 30 derniers jours)
Deepayan Bhadra
Deepayan Bhadra le 27 Jan 2022
Modifié(e) : Stephen23 le 27 Jan 2022
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?

Réponse acceptée

Stephen23
Stephen23 le 27 Jan 2022
Modifié(e) : Stephen23 le 27 Jan 2022
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:

Plus de réponses (0)

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by