Skip to content

Instantly share code, notes, and snippets.

@Rassibassi
Created June 1, 2018 00:36
Show Gist options
  • Select an option

  • Save Rassibassi/b2349f3be4767a75ddc4f35cb775186d to your computer and use it in GitHub Desktop.

Select an option

Save Rassibassi/b2349f3be4767a75ddc4f35cb775186d to your computer and use it in GitHub Desktop.
List all files with certain extension from directory
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