0001 function clean_exp_files(sinfo, modtype_idx, modlist_idx, rootdir)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 error(nargchk(3,4,nargin))
0016
0017 if nargin < 4
0018 rootdir = './';
0019 end
0020
0021 modtype = {'chmod 444', 'rm', 'ls'};
0022
0023 modlist = {'GE','orig_adw','normed','snormed','realigned','srealigned','mean'};
0024
0025
0026 nsub = length(sinfo);
0027
0028 modstr = modtype{modtype_idx};
0029 nmod = length(modlist_idx);
0030 for isub = 1:length(sinfo)
0031 for imod = 1:nmod
0032 fpath = fullfile(rootdir, sinfo(isub).id, 'epi');
0033
0034 switch modlist{modlist_idx(imod)}
0035 case 'orig_adw'
0036 prefix = sinfo(isub).id;
0037 case 'normed'
0038 prefix = 'n';
0039 case 'snormed'
0040 prefix = 'sn';
0041 case 'realigned'
0042 prefix = 'r';
0043 case 'srealigned'
0044 prefix = 'sr';
0045 case 'mean'
0046 prefix = 'mean';
0047 otherwise
0048 disp(sprintf('Do not know how to modify: %s', modlist(modlist_idx(imod))))
0049 end
0050
0051
0052 d = dir(fpath);
0053 dirlist = strvcat(d(strmatch('run',strvcat(d.name))).name);
0054 for idir = 1:size(dirlist,1)
0055 unix_str = sprintf('%s %s/run%d/%s*', modstr, fpath, idir, prefix);
0056 unix(unix_str);
0057 end
0058 end
0059 end