How to edit the mod file via m file in MatLab?

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

How to edit the mod file via m file in MatLab?

Postby fuyangzhao » Fri Dec 11, 2015 1:46 am

Hi everyone:

I'm trying to write a loop in which I can see how the results change with different parameterization. Is there any possibility that I edit the mod file via m file in MatLab in order to change the value of a particular parameter in a loop?

Thanks!
fuyangzhao
 
Posts: 48
Joined: Thu Dec 10, 2015 1:20 pm

Re: How to edit the mod file via m file in MatLab?

Postby jpfeifer » Fri Dec 11, 2015 7:44 am

------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: How to edit the mod file via m file in MatLab?

Postby fuyangzhao » Fri Dec 11, 2015 12:17 pm


Thanks! I read the link you gave me. And I wrote the following code in a MatLab m file:
Code: Select all
etas = 0.5:0.01:1.5;

for numb=1:101
    set_param_value('eta',etas(numb));
    dynare lwz_model.mod;
   
end

And it reports the following
Attempt to reference field of non-structure array.

Error in set_param_value (line 22)
i = strmatch(pname,M_.param_names,'exact');


Can you help me?
fuyangzhao
 
Posts: 48
Joined: Thu Dec 10, 2015 1:20 pm

Re: How to edit the mod file via m file in MatLab?

Postby jpfeifer » Thu Dec 17, 2015 9:34 am

You are supposed to run Dynare once before the loop to initialize everything. Only then you can reset the parameter and call the required functions of Dynare. Please follow the example in the linked post closely, otherwise it will not work.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 8 guests