Borrar filtros
Borrar filtros

Store directory listing into loopable structure

2 visualizaciones (últimos 30 días)
Deepayan Bhadra
Deepayan Bhadra el 27 de En. de 2022
Editada: Stephen23 el 27 de En. de 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?

Respuesta aceptada

Stephen23
Stephen23 el 27 de En. de 2022
Editada: Stephen23 el 27 de En. de 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:

Más respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by