From 287d5a955ecd8d40dfa75f065e76b05a8a5a3571 Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Fri, 30 Sep 2011 12:32:29 +0200
Subject: [PATCH] correcting bugs in conditional forecast. Ported by hand part
 of ac93cac93cd0897847ac2accc4f1ab2cee1ea29d92cbe

---
 matlab/imcforecast.m   | 3 ++-
 preprocessor/Shocks.cc | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/matlab/imcforecast.m b/matlab/imcforecast.m
index 2cad0a768..4bb82e0d9 100644
--- a/matlab/imcforecast.m
+++ b/matlab/imcforecast.m
@@ -164,7 +164,8 @@ idx = [];
 jdx = [];
 
 for i = 1:n1
-    idx = [idx ; oo_.dr.inv_order_var(strmatch(deblank(constrained_vars(i,:)),M_.endo_names,'exact'))];
+    %    idx = [idx ; oo_.dr.inv_order_var(strmatch(deblank(constrained_vars(i,:)),M_.endo_names,'exact'))];
+    idx = [idx ; oo_.dr.inv_order_var(constrained_vars(i,:))];
     jdx = [jdx ; strmatch(deblank(options_cond_fcst.controlled_varexo(i,:)),M_.exo_names,'exact')];
 end
 mv = zeros(n1,NumberOfStates);
diff --git a/preprocessor/Shocks.cc b/preprocessor/Shocks.cc
index 750b93679..eebd89fd0 100644
--- a/preprocessor/Shocks.cc
+++ b/preprocessor/Shocks.cc
@@ -289,9 +289,9 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
        it != paths.end(); it++)
     {
       if (it == paths.begin())
-        output << "constrained_vars_ = '" << it->first << "';" << endl;
+        output << "constrained_vars_ = " << it->first << ";" << endl;
       else
-        output << "constrained_vars_ = char(constrained_vars_, '" << it->first << "');" << endl;
+        output << "constrained_vars_ = [constrained_vars_; " << it->first << "];" << endl;
 
       const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
       for (int i = 0; i < (int) elems.size(); i++)
-- 
GitLab