How to keep residuals after SPM estimation in spm12

How to keep residuals after SPM estimation in spm12 by editing the default code.

Hi,

What residuals are you referring to? and could you share what code you are working with?

Steven

Assuming that you mean the residuals from a GLM estimation, this can be set in the model estimation module.

In the batch: SPM -->stats --> model estimation

When scripting:

matlabbatch{1}.spm.stats.fmri_est.spmmat = '<UNDEFINED>';
matlabbatch{1}.spm.stats.fmri_est.write_residuals = 1; % set to 1 to keep residuals
matlabbatch{1}.spm.stats.fmri_est.method.Classical = 1;
1 Like