how to turn this script into for loop

hi,
i am new to spm and matlab, i was tring to turn this SPM script into a for loop, and I use some of the command line i found online.
But it didn't work at all, how should i get a functional for loop ?

Respuestas (1)

Walter Roberson
Walter Roberson el 20 de Abr. de 2023
subject = '~/lab/MATLAB/subject';
imgfiles = dir(fullfile(subject, 'SL*', 'T.nii*'));
matlabbatch{1}.spm.tools.data_T1 = fullfile({imgfiles.folders}, {imgfiles.name});
But be careful as the order might not match the order for your matlabbatch{1}.spm.tools.data_F2 . Notice that in your _T1 that you use directory SL005 but in your _F2 you use directory SL05 (one zero instead of two). The change in the number of digits does affect the directory sort order.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 20 de Abr. de 2023

Respondida:

el 20 de Abr. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by