How to save sequence of file names into an array?
조회 수: 24 (최근 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!