Using Persistent Variables in Matlab
Persistent variables in Matlab permit to keep the value of a variable across calls to a given function. Because such routines may be used in different context and because Dynare line option noclearall doesn't clear persistent variables from one run to the next, it is necessary to properly initialize persistent variables and not to rely an implicit mechanism such as initializing when the persistent variable is empty.
Here is a list of functions that use persistent variables in an unsafe manner:
Functions not called by Dynare code
- evaluate_likelihood.m (only called by evaluate_posterior_kernel.m)
- masterParallelMan.m (only called by masterParallel.m)
- moment_function.m (only called by simulated_moments_estimation.m)
See trac ticket #83 for the history of this issue.