Macro Processor

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.

Macro Processor

Postby frankcw » Wed May 29, 2013 11:14 pm

Hi, I have a very simple question in macro processing syntax.

Suppose in the mod file I use @#define ramsey = 1, then I use

@#if ramsey
equation 1
@#else
equation 2
@#endif

Is there a way that I can define @#define ramsey = parameter, in which parameter can be controlled in a matlab file and then passed to the mod file?

Thanks a lot!

Frank
frankcw
 
Posts: 11
Joined: Tue Jul 27, 2010 2:25 pm

Re: Macro Processor

Postby HoutanBastani » Mon Jun 03, 2013 12:47 pm

Is your idea to perform multiple runs of dynare with different equations depending on the value of parameter? If so, you can define ramsey when you invoke dynare:

Code: Select all
>> eval(['dynare modfile.mod -Dramsey=' num2str(parameter)])
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France

Re: Macro Processor

Postby alex » Sun Sep 15, 2013 3:43 pm

Dear Houtan,

Related to your answer, how would you include multiple values of the parameter, say for two variables ramsey1 and ramsey2?

Best,
Alex
alex
 
Posts: 10
Joined: Sun Sep 15, 2013 3:41 pm

Re: Macro Processor

Postby HoutanBastani » Mon Sep 16, 2013 6:15 pm

Code: Select all
eval(['dynare modfile.mod -Dramsey1=' num2str(parameter1) -Dramsey2=' num2str(parameter2)])
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France

Re: Macro Processor

Postby alex » Tue Sep 17, 2013 8:18 am

Houtan,

it does not work, in the corresponding line Matlab says that "A quoted string is unterminated"

Alex
alex
 
Posts: 10
Joined: Sun Sep 15, 2013 3:41 pm

Re: Macro Processor

Postby jpfeifer » Tue Sep 17, 2013 8:26 am

It should be
Code: Select all
eval(['dynare modfile.mod -Dramsey1=' num2str(parameter1),' -Dramsey2=' num2str(parameter2)])
------------
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: Macro Processor

Postby alex » Tue Sep 17, 2013 10:23 am

it works thanks!

Best,
Alex
alex
 
Posts: 10
Joined: Sun Sep 15, 2013 3:41 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests