How to save sequence of file names into an array?
11 次查看(过去 30 天)
显示 更早的评论
Hi!
I have a folder full of files in it and I want to save the name of files in an array. Each cell corresponds to a string of the file name. How can I do this?
0 个评论
回答(2 个)
Walter Roberson
2013-8-20
dinfo = dir('YourDirectory');
names_cell = {dinfo.name};
You might also want to
strcat('YourDirectory', '/', names_cell)
if you want to construct the more qualified file names.
0 个评论
the cyclist
2013-8-20
编辑:the cyclist
2013-8-20
Use the dir command.
>> s = dir;
will create a structure with a list of all the files and directories. If you need help converting that info from a structure to a cell array, I recommend you post a second question about that.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!