How to get file names only when using dir()?
317 ビュー (過去 30 日間)
古いコメントを表示
Hello I am trying to get only the file names after using the dir() function without using a for loop. For the moment I am doing the following:
clc;
clear;
folder = uigetdir();
fileList = dir(fullfile(folder, '*.mat'));
Is there a possible way to do what I want in order to be able to sort them and manipulate them easily?
0 件のコメント
回答 (1 件)
Monika Jaskolka
2021 年 5 月 17 日
編集済み: Monika Jaskolka
2021 年 5 月 17 日
fileList = {fileList.name}
If you want to remove the file extension:
fileList = strrep(filelist, '.mat', '')
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!