From 4485c488617d31357c8f405919ced81b1e7db287 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Wed, 24 Sep 2008 19:51:09 +0000
Subject: [PATCH] 4.0: fixed Octave compatibility issues for graphics

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2105 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 matlab/MakeAllFigures.m |  8 ++++----
 matlab/PosteriorIRF.m   |  8 +++++---
 matlab/mode_check.m     | 24 +++++++++++++++---------
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/matlab/MakeAllFigures.m b/matlab/MakeAllFigures.m
index ac8fcf7c73..c1ebb7ccd4 100644
--- a/matlab/MakeAllFigures.m
+++ b/matlab/MakeAllFigures.m
@@ -148,19 +148,19 @@ end
 
 if Info.SaveFormat.Eps
   if isempty(Info.SaveFormat.Name)
-    eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number)]);
+    eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number) '.eps']);
   else
-    eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name]);  
+    eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name '.eps']);  
   end
 end
-if Info.SaveFormat.Pdf
+if Info.SaveFormat.Pdf && ~exist('OCTAVE_VERSION')
  if isempty(Info.SaveFormat.Name)
     eval(['print -dpdf ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number)]);
   else
     eval(['print -dpdf ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name]);  
  end
 end
-if Info.SaveFormat.Fig
+if Info.SaveFormat.Fig && ~exist('OCTAVE_VERSION')
  if isempty(Info.SaveFormat.Name)
     saveas(FigHandle,[M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number) '.fig']);
   else
diff --git a/matlab/PosteriorIRF.m b/matlab/PosteriorIRF.m
index 8a811e5cb3..060dc7872b 100644
--- a/matlab/PosteriorIRF.m
+++ b/matlab/PosteriorIRF.m
@@ -463,9 +463,11 @@ for i=1:M_.exo_nbr
     if subplotnum == MaxNumberOfPlotPerFigure | (j == nvar  & subplotnum> 0)
       figunumber = figunumber+1;
       set(hh,'visible','on')
-      eval(['print -depsc2 ' DirectoryName '/'  M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)]);
-      eval(['print -dpdf ' DirectoryName '/' M_.fname  '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)]);
-      saveas(hh,[DirectoryName '/' M_.fname  '_Bayesian_IRF_' deblank(tit(i,:))  '_' int2str(figunumber) '.fig']);
+      eval(['print -depsc2 ' DirectoryName '/'  M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber) '.eps']);
+      if ~exist('OCTAVE_VERSION')
+          eval(['print -dpdf ' DirectoryName '/' M_.fname  '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber)]);
+          saveas(hh,[DirectoryName '/' M_.fname  '_Bayesian_IRF_' deblank(tit(i,:))  '_' int2str(figunumber) '.fig']);
+      end
       set(hh,'visible','off')
       if options_.nograph, close(hh), end
       if options_.TeX
diff --git a/matlab/mode_check.m b/matlab/mode_check.m
index fc2ded6523..2f67cad384 100644
--- a/matlab/mode_check.m
+++ b/matlab/mode_check.m
@@ -90,9 +90,11 @@ if nbplt == 1
         hold off
         drawnow
     end
-    eval(['print -depsc2 ' M_.fname '_CheckPlots' int2str(1)]);
-    eval(['print -dpdf ' M_.fname '_CheckPlots' int2str(1)]);
-    saveas(hh,[M_.fname '_CheckPlots' int2str(1) '.fig']);
+    eval(['print -depsc2 ' M_.fname '_CheckPlots' int2str(1) '.eps' ]);
+    if ~exist('OCTAVE_VERSION')
+        eval(['print -dpdf ' M_.fname '_CheckPlots' int2str(1)]);
+        saveas(hh,[M_.fname '_CheckPlots' int2str(1) '.fig']);
+    end
     if options_.nograph, close(hh), end  
     % TeX eps loader file
     if TeX
@@ -145,9 +147,11 @@ else
             hold off
             drawnow
         end    
-        eval(['print -depsc2 ' M_.fname '_CheckPlots' int2str(plt)]);
-        eval(['print -dpdf ' M_.fname '_CheckPlots' int2str(plt)]);
-        saveas(hh,[M_.fname '_CheckPlots' int2str(plt) '.fig']);
+        eval(['print -depsc2 ' M_.fname '_CheckPlots' int2str(plt) '.eps']);
+        if ~exist('OCTAVE_VERSION')
+            eval(['print -dpdf ' M_.fname '_CheckPlots' int2str(plt)]);
+            saveas(hh,[M_.fname '_CheckPlots' int2str(plt) '.fig']);
+        end
         if options_.nograph, close(hh), end
         if TeX
             % TeX eps loader file    
@@ -203,9 +207,11 @@ else
         k = k + 1;
         drawnow
     end
-    eval(['print -depsc2 ' M_.fname '_CheckPlots' int2str(nbplt)]);
-    eval(['print -dpdf ' M_.fname '_CheckPlots' int2str(nbplt)]);
-    saveas(hh,[M_.fname '_CheckPlots' int2str(nbplt) '.fig']);
+    eval(['print -depsc2 ' M_.fname '_CheckPlots' int2str(nbplt) '.eps']);
+    if ~exist('OCTAVE_VERSION')
+        eval(['print -dpdf ' M_.fname '_CheckPlots' int2str(nbplt)]);
+        saveas(hh,[M_.fname '_CheckPlots' int2str(nbplt) '.fig']);
+    end
     if options_.nograph, close(hh), end
     if TeX
         fprintf(fidTeX,'\\begin{figure}[H]\n');
-- 
GitLab