Page 1 of 1
Macro Processor
Posted:
Wed May 29, 2013 11:14 pm
by frankcw
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
Re: Macro Processor
Posted:
Mon Jun 03, 2013 12:47 pm
by HoutanBastani
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)])
Re: Macro Processor
Posted:
Sun Sep 15, 2013 3:43 pm
by alex
Dear Houtan,
Related to your answer, how would you include multiple values of the parameter, say for two variables ramsey1 and ramsey2?
Best,
Alex
Re: Macro Processor
Posted:
Mon Sep 16, 2013 6:15 pm
by HoutanBastani
- Code: Select all
eval(['dynare modfile.mod -Dramsey1=' num2str(parameter1) -Dramsey2=' num2str(parameter2)])
Re: Macro Processor
Posted:
Tue Sep 17, 2013 8:18 am
by alex
Houtan,
it does not work, in the corresponding line Matlab says that "A quoted string is unterminated"
Alex
Re: Macro Processor
Posted:
Tue Sep 17, 2013 8:26 am
by jpfeifer
It should be
- Code: Select all
eval(['dynare modfile.mod -Dramsey1=' num2str(parameter1),' -Dramsey2=' num2str(parameter2)])
Re: Macro Processor
Posted:
Tue Sep 17, 2013 10:23 am
by alex
it works thanks!
Best,
Alex