From 89b1216d18757dfa1b688022141a9022aa7372d6 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 29 Mar 2016 14:41:08 +0000
Subject: [PATCH] fix gdat_plot so does plot if called with just gdat structure
 gdat_plot(aa)

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@5597 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/gdat_plot.m | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/crpptbx/gdat_plot.m b/crpptbx/gdat_plot.m
index 590723d6..60183c72 100644
--- a/crpptbx/gdat_plot.m
+++ b/crpptbx/gdat_plot.m
@@ -2,7 +2,7 @@ function [fighandle]=gdat_plot(gdat_data,varargin);
 %
 % choices from doplot in gdat_data.gdat_params.doplot:
 %     doplot = 0: no plot
-%            = 1: new figure created
+%            = 1: new figure created (default if not given)
 %            = -1: add to current figure (with hold all)
 %            > 1: create new figure with this number, adding clf
 %            <-1: add to figure number abs(doplot) (with hold all)
@@ -27,25 +27,27 @@ else
   return
 end
 
-doplot=0;
+doplot=1;
 if isfield(gdat_plot_params,'doplot') && ~isempty(gdat_plot_params.doplot)
   doplot = gdat_plot_params.doplot;
 elseif isfield(gdat_data.gdat_params,'doplot') || ~isempty(gdat_data.gdat_params.doplot)
-  doplot = gdat_data.gdat_params.doplot;
+  if gdat_data.gdat_params.doplot~=0 % assume one does not call gdat_plot not to plot
+    doplot = gdat_data.gdat_params.doplot;
+  end
 end
 if doplot==0; return; end
 
 if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(gdat_data.t)
   fighandle = get(0,'CurrentFigure');
-  if gdat_data.gdat_params.doplot == 1
+  if doplot == 1
     fighandle = figure;
-  elseif gdat_data.gdat_params.doplot > 1
-    fighandle = figure(gdat_data.gdat_params.doplot);
+  elseif doplot > 1
+    fighandle = figure(doplot);
     clf;
-  elseif gdat_data.gdat_params.doplot == -1
+  elseif doplot == -1
     hold all
-  elseif gdat_data.gdat_params.doplot < -1
-    fighandle = figure(abs(gdat_data.gdat_params.doplot));
+  elseif doplot < -1
+    fighandle = figure(abs(doplot));
     hold all
   end
   if strcmp(gdat_data.gdat_request,'eqdsk')
-- 
GitLab