Home > fmri > utils > del_15mat.m

del_15mat

PURPOSE ^

hide_files(fi)

SYNOPSIS ^

function [] = del_15mat(fi)

DESCRIPTION ^

 hide_files(fi)

 fi.rootdir = root directory that contains subject directories
 fi.destdir = name stub of directory to move files into
 fi.prestr = cell array of file prefixes to process
 fi.sub_id{sub1, sub2} = cell array of subject ids
 fi.vol_info(1:nsub) = array of vol_info structures
    vol_info.run_id() = array of runs numbers to use
    vol_info.vol_id{1:nrun} = vectors of volumes for each run to move to destdir

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [] = del_15mat(fi)
0002 % hide_files(fi)
0003 %
0004 % fi.rootdir = root directory that contains subject directories
0005 % fi.destdir = name stub of directory to move files into
0006 % fi.prestr = cell array of file prefixes to process
0007 % fi.sub_id{sub1, sub2} = cell array of subject ids
0008 % fi.vol_info(1:nsub) = array of vol_info structures
0009 %    vol_info.run_id() = array of runs numbers to use
0010 %    vol_info.vol_id{1:nrun} = vectors of volumes for each run to move to destdir
0011 %
0012 
0013 nsub = length(fi.sub_id);
0014 
0015 for isub = 1:nsub
0016   disp(sprintf('removing mat files for subject %s', fi.sub_id{isub}))
0017   subpath = fullfile(fi.rootdir,fi.sub_id{isub});
0018   
0019   for irun = 1:length(fi.vol_info(isub).run_id)
0020     run_idx = fi.vol_info(isub).run_id(irun);
0021     disp(sprintf('    Run %d', run_idx))
0022     
0023     srcdir = fullfile(subpath,sprintf('epi/run%d',run_idx));
0024     %destdir = fullfile(subpath,sprintf('epi/run%d',run_idx),fi.destdir);
0025     
0026     %if ~exist(destdir,'dir')
0027     %  disp(sprintf('Creating directory: %s', destdir))
0028     %  unix(['mkdir ' destdir]);
0029     %end
0030 
0031     nvol = length(fi.vol_info(isub).vol_id{irun});
0032     for ivol = 1:nvol
0033       vol_idx = fi.vol_info(isub).vol_id{irun}(ivol);
0034       
0035       for ipre = 1:length(fi.prestr)
0036     unix_str = sprintf('rm %s/%s%s*i%04d.* %s', srcdir, fi.prestr{ipre},fi.sub_id{isub}, vol_idx);
0037     unix(unix_str);
0038       end
0039     end % for ivol =
0040   end % for irun=
0041 end % for isub=

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