Am Mittwoch, 2. Februar 2005 23:30 schrieb Nicholas Masse:
> Hi everyone.
>
> I'm using a BATCH file to design, estimate and create contrasts for a
> matrix that is modified from Karl Friston's spm_batch.m. The batch works
> perfectly designing and estimating the matrix, but when it comes time to
> create the contrasts for it, matlab spits out the following error:
Hi,
here's how I do the batchfiles for t-contrasts. It makes sure that the contrast
vector has the right dimension and that the correct contrasts are chosen.
If you use hrf+derivative the strmatch has to be changed and *bf(1) has to be
used as well.
You don't have to start the whole spm_spm(SPM) again by only taking the lower part
and start with "load(SPM)". Maybe you also need to call "spm_defaults"
Hope it helps.
Regards,
Roland
Starting after SPM=spm_spm(SPM)
-----------
%delete all Fcontrast but effects of interest. I don't need the other ones
dummy=SPM.xCon(1);SPM.xCon=dummy;clear dummy;
%cuts of Session information Only works for less then 10 Sessions!!
dummy=char(SPM.xX.name);c_names=dummy(:,7:end);clear dummy;
ind_constant=strmatch('constant',c_names);
%indices and contrast vectors for each "interesting" regressor
% naming is of course arbitrary this is just an example for 2 regressors
c_head_w=zeros(1,length(SPM.xX.name));
ind_head_w=strmatch('Header word*',c_names);
c_head_w(ind_head_w)=1;
c_head_ps=zeros(1,length(SPM.xX.name));
ind_head_ps=strmatch('Header pseudo*',c_names);
c_head_ps(ind_head_ps)=1;
%create array with interesting contrasts
%eg simple contrast
tcont(1).name='head word';tcont(1).c=c_head_w;
%eg differential contrast
tcont(2).name='word>pseudo';tcont(2).c=c_head_w-c_head_ps;
%set xCon variables
for i=1:length(tcont)
if (isempty(find(tcont(i).c)))
%check for mistakes
error(['check contrast (tcont nr) ' int2str(i) ' contrast is 0!!!'])
end %if
SPM.xCon(end + 1)=spm_FcUtil('Set',tcont(i).name,'T','c',tcont(i).c(:),SPM.xX.xKXs);
end %i
% and evaluate
%---------------------------------------------------------------------------
spm_contrasts(SPM);
--
Dr. Roland Marcus Rutschmann <[log in to unmask]>
Institute for Experimental Psychology, University of Regensburg
Universitätsstraße 31, 93053 Regensburg, Germany
Tel: +49 941 943 2533, Fax: +49 941 943 3233
http://www.psychologie.uni-regensburg.de/Rutschmann
|