Fail with M_.param_names


I’m using 5.4 version of Dynare to simulate a simple NK model. I use the following codes to load parameter values from a .mat file:

load par;
for jj=1:length(M_.param_names)

However, the codes fails here. I read several forum posts regarding this issue and can’t solve it.

Any help or suggestions will be highly appreciated.

Thank you.

Ping Wang

That is strongly discouraged. But in any case, without the codes it is impossible to tell what is going on. My guess is that you are using code suitable only for Dynare 4.5

Thank you very much for your help and reply, Mr. Pfeifer.

In fact, I’ve tried different versions of dynare and matalb. What’ more, if I simplify the model, the codes works well.

Here are the codes:

Usually, you should have something like

temp=load('par.mat');  % load mat file created in console
for jj=1:length(M_.param_names)

However, not all parameters you are trying to set are contained in par.mat.

Thank you for you help!

That was a mistake that should have been avoided… sorry for that. But I don’t think it caused the error. Now, I checked the parameters at the end of par.m to make sure all the parameters are saved in par.mat, and rewrite the codes into

set_param_value ('alpha',alpha);
set_param_value ('ass',ass);
set_param_value ('beta',beta);
set_param_value ('bss',bss);

The error message is: Structure reference from non-structure array object.

You must not use


in a mod-file. It will delete the relevant variables that Dynare uses.