method to set contrasts into design object D - design C - contrasts C can be a contrast structure, or a structure containing a contrast structure refreshf - if 1 then refresh contrasts with respect to design matrix structures in `D`. Default is 1 Returns D - design with contrasts set to C $Id$
0001 function D = set_contrasts(D, C, refreshf) 0002 % method to set contrasts into design object 0003 % 0004 % D - design 0005 % C - contrasts 0006 % C can be a contrast structure, or a structure containing 0007 % a contrast structure 0008 % refreshf - if 1 then refresh contrasts with respect to design matrix 0009 % structures in `D`. Default is 1 0010 % 0011 % Returns 0012 % D - design with contrasts set to C 0013 % 0014 % $Id$ 0015 0016 if nargin < 2 0017 error('Need contrasts'); 0018 end 0019 if nargin < 3 0020 refreshf = 1; 0021 end 0022 if isfield(C, 'xCon'); 0023 C = C.xCon; 0024 end 0025 SPM = des_struct(D); 0026 if refreshf 0027 % Use add contrasts routine to refresh contrasts 0028 SPM.xCon = []; 0029 D = des_struct(D, SPM); 0030 D = add_contrasts(D, C); 0031 else % Hope for the best 0032 SPM.xCon = C; 0033 D = des_struct(D, SPM); 0034 end