필터 지우기
필터 지우기

Get all files under a folder

조회 수: 19 (최근 30일)
Ron
Ron 2022년 10월 13일
댓글: Ron 2022년 10월 13일
Hello guys,
Im trying to get access to all files under folder that i have with matlab app designer. ( only files, excel files , .m , .mlapp .. etc , with out folders)
I saw in some other answers that i can use :
folderPath=uigetdir(pwd,'Select a folder');
files=dir(fullfile(folderPath,'*.mlap'));
and then i have struct files that i can get access to the file.name and file.name , files.folder ...etc
But it finds only the mlapp files , if I do like this
folderPath=uigetdir(pwd,'Select a folder');
files=dir(fullfile(folderPath, '*' );
it finds also the folders but that's not what i want
Need help to add only excel and another files :)

채택된 답변

Stephen23
Stephen23 2022년 10월 13일
편집: Stephen23 2022년 10월 13일
Just filter out the folders afterwards:
P = uigetdir(pwd,'Select a folder');
S = dir(fullfile(P,'*'));
S([S.isdir]) = [] % remove folders
  댓글 수: 1
Ron
Ron 2022년 10월 13일
Thank you very much !
Working perfect

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by