From 8ab1239d7901c8de0e3444d6a182e581c33b249c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 22 Apr 2015 12:23:20 +0200
Subject: [PATCH] Fix handling of warnings in perfect foresight solver with
 homotopy.

---
 matlab/perfect-foresight-models/perfect_foresight_solver.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver.m b/matlab/perfect-foresight-models/perfect_foresight_solver.m
index 76f2b69dcd..5d1969313d 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_solver.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_solver.m
@@ -68,6 +68,7 @@ if ~oo_.deterministic_simulation.status && ~options_.no_homotopy
     skipline()
     
     % Disable warnings if homotopy
+    warning_old_state = warning;
     warning off all
     % Do not print anything
     oldverbositylevel = options_.verbosity;
@@ -147,7 +148,7 @@ if ~oo_.deterministic_simulation.status && ~options_.no_homotopy
     fprintf('++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n')
     skipline()
     options_.verbosity = oldverbositylevel;
-    warning on all
+    warning(warning_old_state);
 end
 
 if oo_.deterministic_simulation.status == 1
-- 
GitLab