function []=fmrilm_prog(Volume); if isempty(Volume.savefile);Volume.savefile='';end file_str=inputdlg('Enter Name of File to Save Design as (including full path)','Design Save',1,{Volume.savefile}); Volume.savefile=cat(1,file_str{:}); if ~isempty(Volume.savefile) save(Volume.savefile,'Volume'); end if Volume.LM.Input.numinput==1 Volume.LM.Input.filein=[Volume.LM.Input.filepath,Volume.LM.Input.filename]; else Volume=fmris_concat(Volume); end NumCs=size(Volume.LM.Contrast.Contrast,1); Volume.LM.OutputFile.List=[]; for i=1:NumCs num=[num2str(zeros(length(num2str(NumCs))-length(num2str(i)))) num2str(i)]; Volume.LM.OutputFile.List=[Volume.LM.OutputFile.List; Volume.LM.OutputFile.Base '_' num]; end if ~Volume.LM.Batch [Volume.LM.Dfs,Volume.LM.Contrast.Dfs]=fmrilm(Volume.LM.Input.filein,Volume.LM.OutputFile.List,Volume.LM.X_cache.X_cache, ... Volume.LM.Contrast.Contrast,Volume.LM.Exclude.Exclude,Volume.LM.WStats,Volume.LM.FWHM_rho,Volume.LM.N_Poly, ... Volume.LM.RefDelay.RefDelay(:)',Volume.LM.DelayCont,Volume.LM.Confound.Confound,Volume.LM.NumLags); if ~isempty(Volume.savefile) save(Volume.savefile,'Volume'); end else batch_file=create_batch_file(Volume.savefile); execstr=['chmod u+x ' batch_file];unix(execstr); execstr=['batch -Hwart -Qlong ' batch_file];unix(execstr); end set(Volume.fig,'Visible','on'); set(Volume.fig,'Userdata',Volume); return; function [filename]=create_batch_file(savefile); filename=['fmrilm_batch_' datestr(now,1) '_' datestr(now,13) '.csh'];filename=strrep(filename,':','-'); fid=fopen(filename,'w'); if fid>0 outstr=['#! /bin/csh -f\nmatlab6 -nojvm -display none << EOF\nload ',savefile,'\n[Volume.LM.Dfs,Volume.LM.Contrast.Dfs]=' ... 'fmrilm(Volume.LM.Input.filein,Volume.LM.OutputFile.List,Volume.LM.X_cache.X_cache, ...\n' ... 'Volume.LM.Contrast.Contrast,Volume.LM.Exclude.Exclude,Volume.LM.WStats,Volume.LM.FWHM_rho,Volume.LM.N_Poly, ...\n' ... 'Volume.LM.RefDelay.RefDelay(:)'',Volume.LM.DelayCont,Volume.LM.Confound.Confound,Volume.LM.NumLags);\n' ... 'if ~isempty(Volume.savefile)\nsave(Volume.savefile,''Volume'');\nend\n\nexit;\nEOF\n']; fprintf(fid,outstr); fclose(fid); else errordlg('Cannot Create Batch Startup File','Batch Error'); end return;