Code covered by the BSD License  

Highlights from
File List

4.0

4.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 2.72 KB File ID: #22829

File List

by Jedediah Frey

 

29 Jan 2009

File list builds a list of files for use in batch processing.

| Watch this File

File Information
Description

File list builds a list of files for use in batch processing. The user can select the sub-folder depth for recursion, file extensions to search for, and file name to search.

It is helpful for batch processing large number of files in various folders or sub folders.

[files,total]=file_list(pwd,'*.mat',1);
for i=1:total
     data=load(files{i});
     % Do stuff with data
end

MATLAB release MATLAB 7 (R14)
Other requirements Tested on MATLAB Version 7.5.0.342 (R2007b) on Windows XP. Should work cross platform.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
01 Mar 2011 Darin McCoy

Nice work on this Jed - one thing to consider adding....

Replace line 134

temp_file_list = dir(folder);

with

temp_file_listA = dir([folder '\*' file_extension ]);
    
temp_file_listB = dir([folder '\*.']);
    
temp_file_list = [temp_file_listA;temp_file_listB];

This can improve speed substantially (10x)

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data processing Jedediah Frey 30 Jan 2009 16:03:39
batch processing Jedediah Frey 30 Jan 2009 16:03:39

Contact us at files@mathworks.com