Home > fmri > utils > clean_exp_files.m

clean_exp_files

PURPOSE ^

clean_exp_mfiles.m

SYNOPSIS ^

function clean_exp_files(sinfo, modtype_idx, modlist_idx, rootdir)

DESCRIPTION ^

 clean_exp_mfiles.m

 Performs modifications on files in epi directories

 Specify list of indices for things to do (modtype)
 and types of files to modify (modlist)

 modtype = {'chmod 444', 'rm'}
 modlist = {'GE','orig_adw','normed','snormed','realigned','srealigned','mean'}

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function clean_exp_files(sinfo, modtype_idx, modlist_idx, rootdir)
0002 % clean_exp_mfiles.m
0003 %
0004 % Performs modifications on files in epi directories
0005 %
0006 % Specify list of indices for things to do (modtype)
0007 % and types of files to modify (modlist)
0008 %
0009 % modtype = {'chmod 444', 'rm'}
0010 % modlist = {'GE','orig_adw','normed','snormed','realigned','srealigned','mean'}
0011 %
0012 
0013 % 02/23/01 PJ
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 % Get subject info
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     % Delete run by run to circumvent list length limits
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

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003