From 26da40dd22f87ce5bf3b5ca15b81e670f24a666a Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Mon, 21 Oct 2013 16:05:05 +0000
Subject: [PATCH] fix tag

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@4098 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/gdat.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/crpptbx/gdat.m b/crpptbx/gdat.m
index b925e8a7..3627523f 100644
--- a/crpptbx/gdat.m
+++ b/crpptbx/gdat.m
@@ -180,7 +180,12 @@ elseif doplot==-1
     disp(' error in plotting part, most probably because could not guess time dimension correctly. To check')
   end
 end
-if exist('hhh') && ishandle(hhh); set(hhh(1),'Tag',['gdat: ' num2str(shot)]); end
+
+try
+  if exist('hhh') && ishandle(hhh(end)); set(hhh(end),'Tag',['gdat: ' num2str(shot)]); end
+catch
+end
+
 h2=findobj(gca,'-regexp','Tag','gdat:*');
 if ~isempty(h2);
   legend(get(sort(h2),'Tag'));
-- 
GitLab