Page 1 of 1

Running dynare in a matlab function

PostPosted: Fri Dec 07, 2012 4:18 am
by Saint1106
I am trying to optimize welfare for a set of parameters in dynare.
I would like to run the dyname .m file with a function statement, which would have as output the Welfare index.
Apparently dynare does not execute within the function. Is there a trick to remedy this, to get dynare to run within a matlab function statement?
My procedure is to change a parameter, insert it into "load_initial_values" matrix in the dynare program, then execute the dynare .m file,
and then compute welfare. I have a series of optimization functions (simulated annealing and the genetic algorithm) which I would like to use.
Thanks, Paul McNelis

Re: Running dynare in a matlab function

PostPosted: Fri Dec 07, 2012 9:56 am
by HoutanBastani
What do you mean by "function statement"? Do you mean function?

Why do you say that dynare won't execute within a function?

Can you post your code?

Re: Running dynare in a matlab function

PostPosted: Wed Jan 09, 2013 5:23 pm
by SébastienVillemot
Normally you should be able to run dynare within a MATLAB function. To retrieve results, just copy them back from the global oo_ structure.