From 4ecf1d9f5d3fdf6e9ddbe6f054bc5a8f8de9cd52 Mon Sep 17 00:00:00 2001
From: Marco Ratto <marco.ratto@jrc.ec.europa.eu>
Date: Tue, 20 Dec 2016 09:14:48 +0100
Subject: [PATCH] Workaround to avoid popup figures with nodisplay option saved
 as fig in MATLAB.

---
 matlab/dyn_saveas.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/matlab/dyn_saveas.m b/matlab/dyn_saveas.m
index 2bd513cc8d..917ef687b9 100644
--- a/matlab/dyn_saveas.m
+++ b/matlab/dyn_saveas.m
@@ -52,7 +52,11 @@ if any(strcmp('fig',cellstr(DynareOptions.graph_format)))
         error('Octave cannot create fig files!')
     else
         if DynareOptions.nodisplay
-            set(h, 'Visible','on');
+%             set(h,'Units','Normalized')
+%             mypos=get(h,'Position');
+%             set(h,'Position',[-1 -1 mypos(3:4)])
+%             set(h, 'Visible','on');
+            set(h,'CreateFcn','set(gcf, ''Visible'',''on'')') ;
         end
         saveas(h,[fname '.fig']);
     end
-- 
GitLab