[xCon] = reset_xCon(stats_dir); Clobbers and initializes an xCon.mat file that is created during an SPM99 analysis. stats_dir is the name of the analysis directory that contains the SPM.mat and xCon.mat files. This script is particularly useful when using the SPM99 batch mode in a situation where you change the contrasts you are computing and you want to flush out all of the previous contrasts without having to run the whole analysis over again, i.e. you just want to evaluate the updated set of contrasts. Lines that initialize the xCon structure were pulled from the spm_spm.m script.
0001 function [xCon] = reset_xCon(stats_dir) 0002 % [xCon] = reset_xCon(stats_dir); 0003 % 0004 % Clobbers and initializes an xCon.mat file that is created during an SPM99 0005 % analysis. 0006 % 0007 % stats_dir is the name of the analysis directory that contains the SPM.mat 0008 % and xCon.mat files. 0009 % 0010 % This script is particularly useful when using the SPM99 batch mode in a 0011 % situation where you change the contrasts you are computing and you want to 0012 % flush out all of the previous contrasts without having to run the whole 0013 % analysis over again, i.e. you just want to evaluate the updated set of 0014 % contrasts. 0015 % 0016 % Lines that initialize the xCon structure were pulled from the spm_spm.m 0017 % script. 0018 0019 % 1/1/04 Petr Janata 0020 0021 xCon_fname = fullfile(stats_dir,'xCon.mat'); 0022 if exist(xCon_fname) 0023 fprintf('Deleting ... %s\n', xCon_fname); 0024 delete(xCon_fname); 0025 end 0026 0027 load(fullfile(stats_dir,'SPM.mat'),'xX'); 0028 0029 F_iX0 = struct( 'iX0', [],... 0030 'name', 'all effects'); 0031 xCon = spm_FcUtil('Set',F_iX0(1).name,'F','iX0',F_iX0(1).iX0,xX.xKXs); 0032 for i = 2:length(F_iX0) 0033 xcon = spm_FcUtil('Set',F_iX0(i).name,'F','iX0',F_iX0(i).iX0,xX.xKXs); 0034 xCon = [xCon xcon]; 0035 end 0036 0037 save(xCon_fname,'xCon');