Dealing with variables created 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.

Dealing with variables created in MatLab

Postby SH » Thu Sep 04, 2008 2:45 pm

Hi,

Once I execute the dynare('MyModel') command, it appears that Dynare clears all variables I have created in MatLab before. Is there a possibility to use variables created in previous MatLab functions within the .mod file?

I'm thinking about something like:

simulationperiods = 20;
forecasthorizon = 1;
dynare('MyModel', simulationperiods, forecasthorizon);
...

It turns out that the variable simulationperiods or forecasthorizon are cleared after having run dynare. Moreover, I can take the variables as input for dynare but they will be cleared in turn and cannot be used for model calculations. Is there a possibility to deal with variables created in MatLab? THX in advance!
SH
 
Posts: 1
Joined: Thu Sep 04, 2008 2:21 pm

Re: Dealing with variables created in MatLab

Postby StephaneAdjemian » Thu Sep 04, 2008 9:50 pm

Hi,

You just have to define the matlab variables in the mod file. If you don't want to use matlab statements in the mod file, you can use the noclearall keyword (I don't know if this is documented somewhere). In you example, you would have :
Code: Select all
    simulationperiods = 20;
    forecasthorizon = 1;
    dynare MyModel noclearall


Best,
Stéphane.
Stéphane Adjemian
Université du Maine, GAINS and DynareTeam
https://stepan.adjemian.eu
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 11 guests