Filter löschen
Filter löschen

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

13 Ansichten (letzte 30 Tage)
Jason
Jason am 8 Nov. 2013
Bearbeitet: Azzi Abdelmalek am 8 Nov. 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.

Antworten (1)

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

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by