Skip to content

Reusing Post Hoc Edited Solve Files

Erik A. Roberts edited this page Feb 1, 2019 · 4 revisions

Sometimes it is desirable to manually inject code into a solve file after it has been automatically created. One would then reuse this file for different simulation runs by copying the solve folder from the old study_dir to the new one. In most cases, it is best to automatically create the new study_dir, and combine elements from its solve file with the old solve file according to the tips below.


  • Use a new studyinfo.mat file to avoid sim files being saved in the old study_dir.
  • Use a new param.mat file
  • Copy over the first line of the solve file in case the arguments changed
  • If using one_solve_file_flag
    • Make a new solve file automatically first and halt execution after the solve file is made before simulation.
      • Use the new lines at the beginning of the solve file that replace values in struct p from pVecs
    • The old solve file will have a suffix with the number of sims. This should be modified to fit the new number of sims. Also change the comment inside the file with the number of sims.
    • If using 'mex_flag', make a new mex file for each set of simulations with a different number of sims from the vary.