diff --git a/matlab/gdat.m b/matlab/gdat.m
index ae16099ae4d47f47bce0c83fd8674ca907c85825..e21551bfb14986490b743ed75d0a0fe12fa88cdb 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') && numel(args) > 0 && isnumeric(args{1})
+  if nargin > 0 && isnumeric(shot)
     args_in = args;
     for i=1:numel(shot)
       args{1} = shot(i);