Running Dynare in a Matlab loop

Hi, I am trying to estimate some parameters with GMM/SMM.
The structure of my routine is as follows:
0)Compute moments in the data
1)initialize parameter values in Matlab
2)Run .mod file
3)Call dynare results in Matlab
4)compute model-based moments
5) repeat 2)- 4) to minimize GMM/SMM objective function.

In dynare 3 I just defined the parameters in 1) as global variables and launched dynare with option noclearall.
In dynare 4.3.2 it seems that this is not working, that is the parameters initialized in Matlab are not passed to dynare despite the noclearall option.

Do you have any suggestion on how to pass parameters from Matlab to dynare?

I fixed it.


Would you mind posting a brief explanation of your solution? I’m coming across a similar situation I believe and I’d appreciate hearing of your experiences. Thanks.

See here [Designing probability outside the model)