Created
June 1, 2018 00:36
-
-
Save Rassibassi/b2349f3be4767a75ddc4f35cb775186d to your computer and use it in GitHub Desktop.
List all files with certain extension from directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [ fileList ] = listFiles( path, ext ) | |
| if ( strcmp(path(end),'/') || strcmp(path(end),'\') ) | |
| sepper = ''; | |
| else | |
| sepper = filesep; | |
| end | |
| dirList = dir([path sepper '*.' ext]); | |
| fileList = cell(1,length(dirList)); | |
| for ii=1:length(dirList) | |
| fileList{ii} = dirList(ii).name; | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment