Hi!
I have a problem regarding the use of matlab code in the dynare file.
I have partitioned the model into several model blocks and put the different partitions in a separate folder, the folder being called “model_files”. Then I use the macro #@includepath to include the folder where I put the model blocks. In the folder, I also put some m-files, especially the model_steadystate.m file.
I realized that the macro #@includepath does not help regarding the m-files, so i also put into the code addpath ‘model_files’.
This works, but for one caveat, which is terribly annoying, and will have to be fixed in the long run when the model is put to work in my organization.
I have to run “dynare model” twice for this to work. In the first run, I get NaN:s from the parameters calculated in model_steadystate.m. The second time I type “dynare model” it does however run properly, since then the addpath command have gone through.
Why is this happening, and is there any way to fix it without putting the model_steadystate.m file in the same folder as the model.mod file?
(the reason I want them in different folders is because I copy and paste the model files when I do experiments, and if they lie in a separate folder it is easy and fast to do this without missing any important files)
Here is the code (the model’s name is SELMA):
addpath(‘SELMA_files’);
@#includepath “SELMA_files”
@#include “SELMA_VarsParams.mod”
@#include “SELMA_calibration.mod”
@#include “SELMA_modelBlock.mod”
…
Thanks!