Borrar filtros
Borrar filtros

How to use 'dir' to list files in another directory with a string

7 visualizaciones (últimos 30 días)
Jason
Jason el 8 de Nov. de 2013
Editada: Azzi Abdelmalek el 8 de Nov. de 2013
Guys -
I have a variable that is a string describing a path (x = \\drive\folder1\folder2). How can I use 'dir' to create a list of all files in that directory without switching to the directory to do it? I've tried things like
list = dir('%s',x)
but that doesn't work.

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 8 de Nov. de 2013
Editada: Azzi Abdelmalek el 8 de Nov. de 2013
x='E:matlab'
d = dir(x)
f={d.name}

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by