flist = get_spm_flist(srcdir); Gets listing of .img files in a directory and returns a cell array suitable for passing to SPM5 routines
0001 function flist = get_spm_flist(srcdir,srcstub) 0002 % flist = get_spm_flist(srcdir); 0003 % 0004 % Gets listing of .img files in a directory and returns a cell array suitable 0005 % for passing to SPM5 routines 0006 0007 % 02/14/06 Petr Janata 0008 0009 if nargin < 2 0010 srcstub = '*.img'; 0011 end 0012 0013 dirlist = dir(fullfile(srcdir,srcstub)); 0014 nfiles = length(dirlist); 0015 flist = [repmat(srcdir,nfiles,1) repmat('/',nfiles,1) ... 0016 strvcat(dirlist.name)]; % repmat(',1',nfiles,1) 0017 %flist = cellstr(flist);