Dear Karl and others,
I am writing a batch script that runs through several results
directories and computes F-contrasts in each (design matrices have the
same structure in each).
There are 4 conditions and each is modeled by convolving with a basis
set containing 7 functions (3rd order windowed fourier set). These 28
regressors are followed by 10 more that model confounds (e.g. head
motion). Thus, the design matrix constitutes 39 columns (38 regressors
plus one constant term).
Specifying and running the contrast works fine with the GUI, but when I
use the script to generate and run the same contrast I get an error
indicating that the structure of the contrast is incorrect....
??? Error using ==> spm_FcUtil
not contrast dim. in spm_FcUtil c
Error in ==> /home/nramnani/studies/fMRI/comp_basis_functions/do_contrasts.m
On line 27 ==> SPM.xCon(end + 1) =
spm_FcUtil('Set',cname,'F','c',fullcon(:),SPM.xX.xKXs);
In fact, the matrix given by SPM.xCon(n).c for the one that worked was
identical to the one constucted by the script (below). I would be very
grateful for opinions on what I might have done wrong.
Thanks,
Narender
% -- script starts here -- %
% specify results directories
res{1} =
'/home/nramnani/studies/fMRI/comp_basis_functions/eh_hrf_fourier_analysis_copy';
% res{2} = ...add more directories...
for i = 1:length(res) % loop through results directories
% go to results directory and load new SPM
cd(res{i})
load SPM
% construct F contrast and add to SPM.xCon
partcon = kron([0 0 1 0],eye(7)); % F-contrast for condition
3; no zero padding
fullcon = [partcon, zeros(7,11)]'; % pad remaining 11 columns
(including constant term) with zeros and transpose matrix
cname='movement'; % specify contrast name
SPM.xCon(end + 1) =
spm_FcUtil('Set',cname,'F','c',fullcon(:),SPM.xX.xKXs);
% Evaluate contrasts...
%---------------------------------------------------------------------------
spm_contrasts(SPM);
end
--
Narender Ramnani
Cognitive Neuroscience Laboratory
Department of Psychology
Royal Holloway University of London
Egham, Surrey TW20 0EX
Tel: 01784 443519 (Direct)
Fax: 01784 434347 (Departmental)
email: [log in to unmask]
www.pc.rhul.ac.uk/nramnani
|