Page 1 of 1

How to save dynare results in loop into a specified matrix

PostPosted: Thu Dec 27, 2007 2:43 am
by lizeze
I do a loop in which dynare run 100 times, at the same time I want save the same name series into a specified matrix. forexample,
for i=1:100
dynare <filename.mod>
k(i,:) = y %y is series generated by dynare
end
I found it cannot work because dynare refreshs the workspace in matlab everytime, so result show k is not definded and cannot store the y.
who can help me to save dynare results very run into a fixed name matrix?

best regards
lizeze

PostPosted: Tue Jan 01, 2008 1:09 pm
by reubenpjacob
not quite clear what u want to do.
i usually run loops within the mod file.
then matrices appear in the workspace, and those can be easily saved into our own arrays or matrices.

PostPosted: Wed Jan 09, 2008 3:40 pm
by tomiw
you can simply define a vector/matrix/structure with length N in the mod-file which stores the underlying results in each step n and (important) SAVES the object for each step as a mat-file so that you can obtain your object after the loop is done.

greets, tomi

PostPosted: Thu Jun 12, 2008 9:17 pm
by agupta28
Hi tomi,

It is not clear to me how to write loops within the mod file. Could you please post an example where you do this. I am particularly interested in running a loop in which dynare uses the parameter values from the posterior distribution saved in the matrix *_mh*_blck*.mat to calculate the policy and transition function under each new draw.

Thanks.
abhishek.