On Thu, 28 Jul 2022 14:34:46 +0100, Luis W <[log in to unmask]> wrote:
Dear Luis,
you can shorten this
>clear all
>basedir = 'H:\fMRIdata\sub1';
>file = spm_select('List',basedir, '^a.*\.img$');
>File = strcat(basedir,'\', files,',1')
>Files =cellstr(File)
to
clear all
basedir = 'H:\fMRIdata\sub1';
Files = cellstr(spm_select('List',basedir, '^a.*\.img$'));
and assign it as
matlabbatch{1}.spm.spatial.realign.estwrite.data = { Files };
Alternatively, it might be worth exploring the "Save batch and Script" functionality in the Batch GUI. This allows you to specify a template batch and creates a script that helps you collect the necessary data and inserts them at the appropriate places. See the SPM manual for a brief introduction to this feature.
Best,
Volkmar
>
>
>matlabbatch{1}.spm.spatial.realign.estwrite.data = {
> {
> Files
> }
> }';
>
>matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.quality = 0.9;
>matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.sep = 4;
>
>
>Thanks
>
>Luis
|