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

13 次查看(过去 30 天)
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.

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-11-8
编辑:Azzi Abdelmalek 2013-11-8
x='E:matlab'
d = dir(x)
f={d.name}

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by