Running loops and error message

When I try running dynare in a loop, I sometimes get this error message

Processing outputs …ERROR: Can’t open file filename_static.m for writing

??? Error using ==> dynare at 114
DYNARE: preprocessing failed

Is there any way to avoid this? I have tried in some cases with success to slow down the execution of the loop, but that defeats a little bit the purpose. Any other suggestions?

Dear Matteo, what exactly are you trying to accomplish? Running the Dynare preprocessor within a loop is seldom necessary and very inefficient. Do you really want to recreate all Dynare files or are you only varying parameters within a loop? You can also send me the files in question per email so that I can provide you with more detailed feedback.



Hi Johannes

Your reply helped a lot and convinced me to bypass the pre-processor. I eventually managed to bypass invoking the pre-processor every time.

Every time I have to learn it again. Maybe for next time is there a handy reference on how to loop over parameters?

Thanks a lot

Dear Matteo,

currently, the best reference is [Loop over parameters). Better documenting this is on my to do list for my “Guide to Observation Equations”.