# Storing IRF values when looping over variables v 6.2

**URL:** <https://forum.dynare.org/t/storing-irf-values-when-looping-over-variables-v-6-2/26986>\
**Category:** Stochastic simulations\
**Created:** [6 January 2025 08:13 UTC](https://forum.dynare.org/t/storing-irf-values-when-looping-over-variables-v-6-2/26986 "2025-01-06T08:13:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mandis](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mandis](https://forum.dynare.org/u/mandis)\
**Post date:** [6 January 2025 08:14 UTC](https://forum.dynare.org/t/storing-irf-values-when-looping-over-variables-v-6-2/26986/1 "2025-01-06T08:14:00Z")

</div>

Hi. I am running an RBC model where I loop over 3 values of gamma. However, when I try to save the IRF output, it gives me the same values regardless of the value of gamma that I use. This is in-spite of the automatic IRF graphs being very different depending on the value of gamma. A lot of debugging suggests that stoch\_simul is not saving new values in oo\_.irf. I have attached my matlab code and my .mod file. How can I save the IRF results from the loop so that I can create one nice graph using Matlab?  
[dynare\_example\_driver.m](https://forum.dynare.org/uploads/short-url/w3Od43qub9NJk1B51ghljdgkYTg.m) (4.2 KB)  
[RBC\_shocks.mod](https://forum.dynare.org/uploads/short-url/ei0oYRl0ygrHXppMrLUcWz5ZuTI.mod) (3.2 KB)

---

<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:** [6 January 2025 09:21 UTC](https://forum.dynare.org/t/storing-irf-values-when-looping-over-variables-v-6-2/26986/2 "2025-01-06T09:21:56Z")

</div>

For Dynare 6 you forgot to request the output of `stoch_simul`:

```auto
   [info, oo_] = stoch_simul(M_, options_, oo_, var_list_);

```

[dynare\_example\_driver.m](https://forum.dynare.org/uploads/short-url/5h2ELcK0MPQwxyh7SuTFrA6MLAI.m) (4.3 KB)  
[RBC\_shocks.mod](https://forum.dynare.org/uploads/short-url/ei0oYRl0ygrHXppMrLUcWz5ZuTI.mod) (3.2 KB)

---

<div class="post-metadata">

**Author:** ![mandis](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/cab0a1/32.png) [@mandis](https://forum.dynare.org/u/mandis)\
**Post date:** [6 January 2025 15:43 UTC](https://forum.dynare.org/t/storing-irf-values-when-looping-over-variables-v-6-2/26986/3 "2025-01-06T15:43:56Z")

</div>

Thank you so much! Worked like a charm.
