From 27408f5bfbcd9519d1bcab27e8d0e12eacb39364 Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Tue, 11 Jun 2024 08:43:31 +0200 Subject: [PATCH] check dims before using --- matlab/gdat.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/matlab/gdat.m b/matlab/gdat.m index 1edabd9b..ae16099a 100644 --- a/matlab/gdat.m +++ b/matlab/gdat.m @@ -188,7 +188,7 @@ try args = [{shot,data_request},varargin_eff]; end % treat multiple shot numbers - if exist('shot') && isnumeric(args{1}) + if exist('shot') && numel(args) > 0 && isnumeric(args{1}) args_in = args; for i=1:numel(shot) args{1} = shot(i); @@ -215,11 +215,13 @@ catch ME_gdat return end -for i=1:numel(gdat_data) - gdat_data(i).gdat_call = gdat_call; +if numel(gdat_data) > 0 + for i=1:numel(gdat_data) + gdat_data(i).gdat_call = gdat_call; + end end -if gdat_data(1).gdat_params.doplot +if numel(gdat_data) > 0 && gdat_data(1).gdat_params.doplot try % plot gdat_data versus 1st dim by default, if nb_dims<=2, otherwise do not plot hhh = gdat_plot(gdat_data); % return handle to figure -- GitLab