From 6e981b8a7f256a40cac45c37a73022ae1d6597d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 13 Feb 2025 17:34:36 +0100
Subject: [PATCH] =?UTF-8?q?Allow=20MATLAB/Octave=20vectors=20in=20?=
 =?UTF-8?q?=E2=80=9Cconditional=5Fforecast=5Fpaths=E2=80=9D=20block?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Ref. dynare#1949

(manually cherry picked from commit 9372796b0552b442f2f363cdc987001f4824c779)
---
 src/Shocks.cc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/Shocks.cc b/src/Shocks.cc
index 1b7f54db..82e0d301 100644
--- a/src/Shocks.cc
+++ b/src/Shocks.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2023 Dynare Team
+ * Copyright © 2003-2025 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -627,12 +627,11 @@ ConditionalForecastPathsStatement::writeOutput(ostream& output,
         output << "constrained_vars_ = [constrained_vars_; "
                << symbol_table.getTypeSpecificID(id) + 1 << "];" << endl;
       for (const auto& [period1, period2, value] : elems)
-        for (int j = period1; j <= period2; j++)
-          {
-            output << "constrained_paths_(" << k << "," << j << ")=";
-            value->writeOutput(output);
-            output << ";" << endl;
-          }
+        {
+          output << "constrained_paths_(" << k << "," << period1 << ":" << period2 << ")=";
+          value->writeOutput(output);
+          output << ";" << endl;
+        }
       k++;
     }
 }
-- 
GitLab