Read files from folder with specific name
19 ビュー (過去 30 日間)
古いコメントを表示
I am using the following code to read all files from a folder:
Files=dir('*');
for k=1:length(Files)
FileNames=Files(k).name;
end
However I want to read the files which names begin with "word" not just all files in folder. How can I perform such task?
0 件のコメント
採用された回答
Image Analyst
2014 年 7 月 1 日
Files=dir('word*.*');
7 件のコメント
Ihaveaquest
2022 年 8 月 16 日
what if there are multiple files with similar name but you only want the most current created ??
Image Analyst
2022 年 8 月 17 日
@Ihaveaquest, to find the newest file, do this:
fileList = dir('t*.m')
fileDates = [fileList.datenum]
% Find newest file
[maxDate, index] = max(fileDates)
fprintf('The newest file is:\nName: %s\nDate: %s\n', ...
fileList(index).name, fileList(index).date)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!