Add preprocessor option like onlyclearglobals
Currently, each run of Dynare either clears the whole workspace of nothing at all. This is problematic for running Dynare in a loop from a wrapping script. A regular call will delete all variables of the wrapping script, while using noclearall
leads to previous global variables interfering with subsequent runs (e.g. via the set_default_option
-command)
I would suggest a preprocessor option onlyclearglobals
that uses
clear M_ options_ oo_ estim_params_ bayestopt_ dataset_
instead of clear all
to delete the global variables of Dynare that interfere with repeated calls.