# Loop

**URL:** <https://forum.dynare.org/t/loop/892>\
**Category:** Dynare v4 (legacy)\
**Created:** [24 December 2008 17:53 UTC](https://forum.dynare.org/t/loop/892 "2008-12-24T17:53:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivip](https://forum.dynare.org/letter_avatar_proxy/v4/letter/i/e9bcb4/32.png) [@ivip](https://forum.dynare.org/u/ivip)\
**Post date:** [24 December 2008 17:53 UTC](https://forum.dynare.org/t/loop/892/1 "2008-12-24T17:53:37Z")

</div>

Dear all,

I’m trying to perform an optimal monetary policy exercise for different values of a parameters, something that should be straightforward with a simple loop in MATLAB. I have tried appending after the model the following line of commands:

@#for iii in 1:9

TT\_x=THETA\_x(@{iii},1);  
theta\_x=TT\_x;  
ramsey\_policy(irf=0,noprint);

VARIANCE\_all(:,:,@{iii})=oo\_.var;

@#endfor

(where theta\_x is the parameter that I want to change, THETA\_x (9x1) store all the possible values of theta\_x and VARIANCE\_all is the 3 dymensional matrix where I am trying to store the variances in each iteration, I’ve tried to change it to be 2 dymensional, but it still does not work).  
Is anyone able to give me any suggestion on how to do this?!

thanks a lot for your help.

IP

---

<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:** [24 July 2017 13:37 UTC](https://forum.dynare.org/t/loop/892/2 "2017-07-24T13:37:13Z")

</div>

Closed on 24 July 2017 13:37 UTC


