From 4a900bc066eccde2fd2a9e0f5f4c0aa179943bc5 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <Olivier.Sauter@epfl.ch>
Date: Fri, 16 Apr 2021 17:14:06 +0200
Subject: [PATCH] label fix

---
 matlab/gdat_plot.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/matlab/gdat_plot.m b/matlab/gdat_plot.m
index 5c378833..464fd6c8 100644
--- a/matlab/gdat_plot.m
+++ b/matlab/gdat_plot.m
@@ -126,8 +126,12 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(
   maxnblines = 1;
   for i=1:numel(linehandles)
     maxnblines = max(maxnblines,numel(linehandles{i}));
-    for j=1:numel(linehandles{i})
-      set(linehandles{i}(j),'DisplayName',[num2str(gdat_data.shot) ',' num2str(j)]);
+    if numel(linehandles{i}) == 1
+      set(linehandles{i},'DisplayName',[num2str(gdat_data.shot)]);
+    else
+      for j=1:numel(linehandles{i})
+        set(linehandles{i}(j),'DisplayName',[num2str(gdat_data.shot) ',' num2str(j)]);
+      end
     end
   end
   if maxnblines==1; legend show; end
-- 
GitLab