Hello SPM experts,
I am doing 1st level model using SPM12.
Condition labels/onsets/durations in the design matrix are specified as follows:
------------------------------------------------------------------------------------------------------------------------------------------
params.condNames = {'left','right','up','down'};
params.condOnsets = {[132 153 ; ...
27 48 ; ...
69 90 ; ...
6 111 ],...
[27 132 ; ...
69 153 ; ...
90 111 ; ...
6 48 ],...
[6 132 ; ...
27 48 ; ...
111 153 ; ...
69 90 ]}; % Unit = scan/time-point/vol
params.condDurations = [15 15 15 15];
------------------------------------------------------------------------------------------------------------------------------------------
I have 3 runs with different onset values for the 4 conditions, so you see 3 cells in params.condOnsets.
Now I perform the following contrasts:
------------------------------------------------------------------------------------------------------------------------------------------
contrasts = {'left vs rest','right vs rest','up vs rest','down vs rest'};
contrast_mat = [ 1 0 0 0 ; 0 1 0 0 ; 0 0 1 0 ; 0 0 0 1];
...
if set_contrasts
for j = 1:length(params.runInds)
clear jobs
for i = 1:length(contrasts)
jobs{1}.spm.stats.con.spmmat = {fullfile(params.designMatDir{j},'SPM.mat')};
jobs{1}.spm.stats.con.consess{i}.tcon.name = contrasts{i};
jobs{1}.spm.stats.con.consess{i}.tcon.weights = contrast_mat(i,:)';
jobs{1}.spm.stats.con.consess{i}.tcon.sessrep = 'none';
end
jobs{1}.spm.stats.con.delete = 0;
save(fullfile(params.batchDir, ['contrastMat' num2str(j) '.mat']),'jobs');
spm_jobman('run', jobs);
end
end
------------------------------------------------------------------------------------------------------------------------------------------
And got the following error:
------------------------------------------------------------------------------------------------------------------------------------------
SPM12: spm_contrasts.m 17:46:06 - 13/06/2017
Contrasts folder : .\designMat1_noHemLag_FDR
contrast image 1 : ...written con_0001.nii
spm{T} image 1 : ...written spmT_0001.nii
contrast image 2 : ...written con_0002.nii
spm{T} image 2 : ...written spmT_0002.nii
0 0 1 0 <- !invalid contrast
Failed 'Contrast Manager'
Error using spm_run_con (line 249)
Error in contrast specification
In file "C:\Users\Administrator\Documents\MATLAB\spm12\config\spm_run_con.m" (v6764), function "spm_run_con" at line 249.
The following modules did not run:
Failed: Contrast Manager
------------------------------------------------------------------------------------------------------------------------------------------
Any ideas on how to fix this error?
Thanks a lot.
Duong
|