# Using Dynare as a Matlab function

**URL:** <https://forum.dynare.org/t/using-dynare-as-a-matlab-function/11911>\
**Category:** Macro-language\
**Created:** [31 May 2018 12:35 UTC](https://forum.dynare.org/t/using-dynare-as-a-matlab-function/11911 "2018-05-31T12:35:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecastro](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/b782af/32.png) [@ecastro](https://forum.dynare.org/u/ecastro)\
**Post date:** [31 May 2018 12:35 UTC](https://forum.dynare.org/t/using-dynare-as-a-matlab-function/11911/1 "2018-05-31T12:35:42Z")

</div>

Hello Johannes and all,  
How would I write a Matlab script calling Dynare as a function? What would be the proper syntax? I have in mind the following algorithm:

```
model <- model_file.mod; (without some parameter values)
x <- parameter values;
run dynare (model,x);
y <- oo_.dr

```

I need to collect oo\_.dr for different models and parameter values automatically. How can I implement this algorithm in Matlab?  
Regards,  
Eduardo

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [2 June 2018 15:31 UTC](https://forum.dynare.org/t/using-dynare-as-a-matlab-function/11911/2 "2018-06-02T15:31:04Z")

</div>

Please see [Loop over parameters](https://forum.dynare.org/t/loop-over-parameters/3335)

---

<div class="post-metadata">

**Author:** ![ecastro](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/b782af/32.png) [@ecastro](https://forum.dynare.org/u/ecastro)\
**Post date:** [4 June 2018 20:33 UTC](https://forum.dynare.org/t/using-dynare-as-a-matlab-function/11911/3 "2018-06-04T20:33:24Z")

</div>

Will do. Thanks.  
Eduardo.
