Saving reports of multiple simulations to different files

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.

Saving reports of multiple simulations to different files

Postby mikelaughton » Tue Feb 25, 2014 12:21 pm

Hi,

I'm running a basic OLG model and want to report the results implied by different values of rho. I tried handling this with a macro-processor loop but I kept getting errors about too many equations for variables. So I did it instead with an Octave loop and the simulations run absolutely fine as they're supposed to.

However, I tried to do something like this:
Code: Select all
for i = 1:4
...
f = ["reports" i ".txt"];
dynatype(f);


And all that happens is that Dynatype saves to a file called "f".

I'd be really grateful if anybody could explain what I'm doing wrong.

Best,
Mike
mikelaughton
 
Posts: 3
Joined: Tue Jan 14, 2014 11:42 am

Re: Saving reports of multiple simulations to different file

Postby jpfeifer » Tue Feb 25, 2014 12:49 pm

Shouldn't it be
Code: Select all
f = ['reports',num2str(i),'.txt'];
------------
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: Saving reports of multiple simulations to different file

Postby mikelaughton » Tue Feb 25, 2014 2:55 pm

Hi, thanks for the response.

The num2str bit is right (I forgot that!) but the file that the simulations save to is still just called "f" (i.e., not what f signifies).

So what happens is that a file called f is created and is overwritten with each simulation. Just need to get dynasave to accept a variable name, if that's possible.

Thanks again
mikelaughton
 
Posts: 3
Joined: Tue Jan 14, 2014 11:42 am

Re: Saving reports of multiple simulations to different file

Postby jpfeifer » Wed Feb 26, 2014 10:56 am

Try wrapping it into an eval-command:
Code: Select all
eval(['dynatype(''reports',num2str(i),'.txt'')'])
------------
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: Saving reports of multiple simulations to different file

Postby mikelaughton » Wed Mar 05, 2014 3:17 pm

Thanks so much!
mikelaughton
 
Posts: 3
Joined: Tue Jan 14, 2014 11:42 am


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests