@@ -80,6 +80,7 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
8080 end
8181
8282 % save the matlabbatch
83+ [~ , ~ , ~ ] = mkdir(JOBS_dir );
8384 save(fullfile(JOBS_dir , ...
8485 [' jobs_matlabbatch_SPM12_SmoothCon_' ,...
8586 num2str(mmConSmoothing ),' _' ,...
@@ -193,6 +194,7 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
193194 fprintf(1 ,' Create Mean Struct and Mask IMAGES...' )
194195
195196 % save the matlabbatch
197+ [~ , ~ , ~ ] = mkdir(JOBS_dir );
196198 save(fullfile(JOBS_dir , ...
197199 ' jobs_matlabbatch_SPM12_CreateMeanStrucMask.mat' ), ...
198200 ' matlabbatch' )
@@ -229,7 +231,7 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
229231 % the strrep(Session{j}, 'trial_type.', '') is there to remove
230232 % 'trial_type.' because contrasts against baseline are renamed
231233 % at the subject level
232- conName = strrep (grpLvlCon{j }, ' trial_type. ' , ' ' );
234+ conName = rmTrialTypeStr (grpLvlCon{j });
233235
234236 con = con + 1 ;
235237
@@ -284,11 +286,10 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
284286 fprintf(1 ,' A DIRECTORY WITH THIS NAME ALREADY EXISTED AND WAS OVERWRITTEN, SORRY \n ' );
285287 rmdir(fullfile(RFX_FolderName , conName ),' s' )
286288 end
289+
287290 mkdir(fullfile(RFX_FolderName , conName ))
288-
289- matlabbatch{j }.spm.stats.factorial_design.dir = {...
290- fullfile(RFX_FolderName ,...
291- grpLvlCon{j }) };
291+ matlabbatch{j }.spm.stats.factorial_design.dir = { fullfile(RFX_FolderName , conName ) };
292+
292293 end
293294
294295 % Go to Jobs directory and save the matlabbatch
@@ -307,10 +308,8 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
307308 matlabbatch = {};
308309
309310 for j = 1 : size(grpLvlCon ,1 )
310- matlabbatch{j }.spm.stats.fmri_est.spmmat = {...
311- fullfile(RFX_FolderName ,...
312- grpLvlCon{j },...
313- ' SPM.mat' )};
311+ conName = rmTrialTypeStr(grpLvlCon{j });
312+ matlabbatch{j }.spm.stats.fmri_est.spmmat = { fullfile(RFX_FolderName , conName , ' SPM.mat' ) };
314313 matlabbatch{j }.spm.stats.fmri_est.method.Classical = 1 ;
315314 end
316315
@@ -332,10 +331,8 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
332331
333332 % ADD/REMOVE CONTRASTS DEPENDING ON YOUR EXPERIMENT AND YOUR GROUPS
334333 for j = 1 : size(grpLvlCon ,1 )
335- matlabbatch{j }.spm.stats.con.spmmat = {...
336- fullfile(RFX_FolderName ,...
337- grpLvlCon{j },...
338- ' SPM.mat' )};
334+ conName = rmTrialTypeStr(grpLvlCon{j });
335+ matlabbatch{j }.spm.stats.con.spmmat = {fullfile(RFX_FolderName , conName , ' SPM.mat' )};
339336 matlabbatch{j }.spm.stats.con.consess{1 }.tcon.name = ' GROUP' ;
340337 matlabbatch{j }.spm.stats.con.consess{1 }.tcon.convec = 1 ;
341338 matlabbatch{j }.spm.stats.con.consess{1 }.tcon.sessrep = ' none' ;
@@ -354,3 +351,9 @@ function BIDS_RFX(action, mmFunctionalSmoothing, mmConSmoothing, opt, isMVPA)
354351end
355352
356353end
354+
355+
356+
357+ function conName = rmTrialTypeStr(conName )
358+ conName = strrep(conName , ' trial_type.' , ' ' );
359+ end
0 commit comments