Loading parameter from an external .mat files

Hi All,

I am currently using 4.5.7 version of Dynare and using the following code to load the parameter values from an external .mat file :

load parmat;
for k=1:length(M_.param_names)
set_param_value(M_.param_names{k},eval(M_.param_names{k})); 
end;

I have read a couple of forum replies on this issue and figured that this has to do with the version I am using, but could not get it solved. However, in running the above code, I get the following error:

"Brace indexing is not supported for variables of this type."

Any help or suggestions will be highly appreciated.

Thank you.

Best,
Mamoon

I would need to see the files.

Hi Johannes,

Sent you a message with the files.

Best,
Mamoon

In Dynare 4.5 the parameter names are still a char-array, not a cell. Is there a reason for not updating to 5.2?

Hi Johannes,

Thank you very much for your reply. So updating Dynare to 5.2 will solve the problem? The code can be just it is?

Hi Johannes,

It works with 5.2. But I was still wondering if you have any suggestions on changes to existing code that would run with an older version.

Thank you!

load( filename )** loads data from filename . If filename is a MAT-file, then load(filename) loads variables in the MAT-file into the MATLABĀ® workspace. If filename is an ASCII file, then load(filename) creates a double-precision array containing data from the file.
please contact me here: https://forum.dynare.org/t/loading-parameter-dorado manana-from-an-external-mat-files/21169
Thanks.

Before Dynare 4.6, it should be

for jj=1:length(M_.param_names)
    set_param_value(deblank(M_.param_names(jj,:)),eval(deblank(M_.param_names(jj,:))));
end;

Awesome thank you!