How to use only specific files in directory in GUI?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello all.
I have a GUI function that can open a directory/folder of images. What I would like to do is actually only select the files/images with the word "PU" in their titles. How would I be able to do this/approach this problem?
Thank you.
댓글 수: 2
Rik
2019년 2월 14일
Are you using a special file picker, the builtin uigetfile, or dir to get file names?
답변 (2개)
Jan
2019년 2월 15일
folder = uigetdir('Choose a folder');
List = dir(fullfile(folder, 'PU*.*'));
FileName = fullfile(folder, {List.name});
for iFile = 1:numel(FileName)
File = FileName{iFile}
... now open it
end
댓글 수: 0
Robert
2019년 2월 15일
Not sure what you mean by 'select', but you can show a user only the files containing 'PU' in their titles using
[fileName, pathName] = uigetfile('*PU*', 'This is my dialog title', 'MultiSelect', 'on');
참고 항목
카테고리
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!