Hi Cyril,
gencode() is exactly what is used to save a batch as .m file. Its most recent version is included within matlabbatch and SPM, the version from matlabcentral may be a bit out of date. In SPM, file name lists are always cell arrays of strings. This avoids issues with space characters and padding that might occur when using character arrays instead. MATLAB nowadays has a separate string datatype, but SPM12 was developed for MATLAB versions that did not have this datatype yet.
Cell arrays of cellstr file lists occur naturally for repeated input items that contain repeated file lists (e.g. multiple sessions in Realign->Estimate). Each session is a cellstr list of filenames, and the collection of sessions is wrapped in another cell array.
Best,
Volkmar
|