wiki:nowaitlock

It is sometimes convenient to submit jobs and let them run in the background. This easiest way to do this is to run the same step twice, with a variable loadonly that indicates whether we want to submit the job (when it is 0) or load results once the job is completed (1).

%Do we need to submit the job or download the results?
loadonly = 0;

if perform(org,'Stepname')
   loadmodel(org,'PreviousStepName');

   %Make sure jobs are submitted without MATLAB waiting for job completion 
   md.settings.waitonlock = 0;
   md.cluster.interactive = 0; %only needed if you are using the generic cluster
   md.miscellaneous.name = 'YourJobName'; 

  %Submit job or download results, make sure that there is no runtime name (that includes the date)
   md=solve(md,'Transient','runtimename',false,'loadonly',loadonly);

   %Save model if necessary
   if  loadonly
      savemodel(org,md);
   end
end

Now, to submit jobs, set loadonly = 0 and launch your simulation. Once it is fully completed, you can set loadonly = 1 and run the same script, all the results will be downloaded and the model will be saved with a unique name. Good luck!

Last modified 10 months ago Last modified on 06/27/23 08:14:41
Note: See TracWiki for help on using the wiki.