Order of calling Dynare matters for error

Hi all,

I am generating MATLAB to call Dynare repeatedly with different parameterizations of the .mod File, which in turn uses the pre-processor. My problem is that although this generates identical .m-files (…dynamic.m, static.m and the main file), it generates an error message if I call Dynare to run a model with a different model-section before.

I used winmerge to compare the sets of generated .m-Files and it found no difference. When calling the allegedly identical .m-Files as the first type of model, it works fine. Nevertheless, when the set of .m-files is generated after I used a different model first, Dynare produces this error message (there are indeed only 108 variables with all leads and lags):

"??? Attempted to access y(109); index out of bounds because numel(y)=108.

Error in ==> Main_dynamic at 102
rhs =(-y(87))+y(109)-y(89)+T70y(106)+T74y(107);
Error in ==> sim1 at 72
[d1,M_.jacobia] = feval([M_.fname 'dynamic’],z,oo.exo_simul, M_.params, it_);
Error in ==> simul at 71
sim1 ;
Error in ==> Main at 656

Changing the order in which I called Dynare resulted in an error message in the subsequent line of sim1.m.

I tried both Dynare 4.0.4 and 4.1. I have cleared everything before calling Dynare from my Batch-File, deleted the generated .m-files and looked for other files in the current directory, but I couldn’t find any difference. I also believe it’s not an issue of temporary MATLAB files, because when I call the .m-File directly from a different MATLAB terminal I have the same problem.

I would appreciate any ideas.


it was my fault - obviously, I guess. The issue was that the oo_ structure was preserved from previous dynare calls…