diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index 345182edebf19f6143c02b12e11e2e772c8f6a11..16014647adbc3c95ef8938bd335a7042902a3363 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -137,8 +137,12 @@ do_mdsopen_mdsclose = 1;
 % treat 1st arg
 if nargin>=1
   if isempty(shot)
-    % means mdsopen(shot) already performed
-    shot_mds = mdsipmex(2,'$SHOT');
+    % means mdsopen(shot) already performed or not shot asked for
+    try
+      shot_mds = mdsipmex(2,'$SHOT');
+    catch
+      shot_mds = shot;
+    end
     if isnumeric(shot_mds); shot = shot_mds; end
     gdat_data.shot = shot;
     do_mdsopen_mdsclose = 0;