How to save sequence of file names into an array?
50 ビュー (過去 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!