From f565a0a84a2b5ef451fe29f1b1a30cd9379870c5 Mon Sep 17 00:00:00 2001
From: Marco Ratto <marco.ratto@ec.europa.eu>
Date: Mon, 6 Feb 2023 11:39:24 +0100
Subject: [PATCH] bug fix and avoid missing output arguments and when smoother
 exits after non convergence of simulation.

---
 matlab/+occbin/DSGE_smoother.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/matlab/+occbin/DSGE_smoother.m b/matlab/+occbin/DSGE_smoother.m
index 59175ccf13..ead33b243d 100644
--- a/matlab/+occbin/DSGE_smoother.m
+++ b/matlab/+occbin/DSGE_smoother.m
@@ -146,7 +146,8 @@ options_.noprint = true;
 [~, out, ss] = occbin.solver(M_,oo_,options_);
 if out.error_flag
     fprintf('Occbin smoother:: simulation within smoother did not converge.\n')
-    print_info(error_flag, false, options_)
+    print_info(out.error_flag, options_.noprint, options_)
+    oo_.occbin.smoother.error_flag=1;
     return;
 end
 regime_history = out.regime_history;
@@ -211,7 +212,8 @@ while is_changed && maxiter>iter && ~is_periodic
     [~, out, ss] = occbin.solver(M_,oo_,options_);
     if out.error_flag
         fprintf('Occbin smoother:: simulation within smoother did not converge.\n')
-        print_info(error_flag, false, options_)
+        print_info(out.error_flag, false, options_)
+        oo_.occbin.smoother.error_flag=1;
         return;
     end
     regime_history = out.regime_history;
-- 
GitLab