Look at this output: >> x = deal(fullfile(pwd,'scripts','CompareRepeated','CompareRepeated_4pairs.m')) x = /home/cwatson/scripts/CompareRepeated/CompareRepeated_4pairs.m >> x = deal(fullfile(pwd,'scripts','CompareRepeated','CompareRepeated_',num2str(4),'pairs.m')) x = /home/cwatson/scripts/CompareRepeated/CompareRepeated_/4/pairs.m Do you see the difference? Do it this way instead: >> x = deal([pwd '/scripts/CompareRepeated/CompareRepeated_' num2str(npair) 'pairs.m']) x = /home/cwatson/scripts/CompareRepeated/CompareRepeated_4pairs.m Steve Masson wrote: > Dear SPM users, > > Why this line works with matlabbatch: > [jobs{:}] = deal(fullfile > (studydir, 'scripts','CompareRepeated', 'CompareRepeated_4pairs.m')); > > But not this one: > npair = 4 > [jobs{:}] = deal(fullfile (studydir, > 'scripts','CompareRepeated',strcat('CompareReapeated_',num2str(npair),'pairs.m'))); > > Is there a problem to use strcat with matlabbatch. > > Regards, > > Steve