diff --git a/matlab/TCV_IMAS/tcv2ids.m b/matlab/TCV_IMAS/tcv2ids.m
index aa881ef4f7d666f4724f2578e0a85333fc85ea35..a78490fbb50d78fbd3f6f565e77e2ab76678b2fe 100644
--- a/matlab/TCV_IMAS/tcv2ids.m
+++ b/matlab/TCV_IMAS/tcv2ids.m
@@ -29,6 +29,12 @@ function [ids_from_tcv,varargout] = tcv2ids(shot,varargin);
 % varargout{1}: return also the ids in array of structure with the names, to allow easy use of plotallids
 %
 
+imas_version_number=str2num(getenv('IMAS_VERSION'));
+cocos_out_default=11;
+if imas_version_number(1) >= 4
+    cocos_out_default=17;
+end
+
 % initialize input parser
 p = inputParser;
 % no required inputs here so one can call with empty args and get defaults parameters
@@ -37,7 +43,7 @@ ids_names = tcv_available_ids;
 p.addOptional('shot', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
 p.addOptional('ids_names', ids_names, @(x) isempty(x) || iscell(x) ); % char or cell array
 p.addOptional('error_bar', 'delta', @(x) isempty(x) || ischar(x) ); % char or cell array
-p.addOptional('cocos_out', 11, @(x) isempty(x) || isnumeric(x) ); % char
+p.addOptional('cocos_out', cocos_out_default, @(x) isempty(x) || isnumeric(x) ); % char
 p.addOptional('ipsign_out', 0, @(x) isempty(x) || (isscalar(x) && (x==0 || x==-1 || x==+1)) );
 p.addOptional('b0sign_out', 0, @(x) isempty(x) || (isscalar(x) && (x==0 || x==-1 || x==+1)) );
 p.addOptional('nverbose', 1, @(x) isempty(x) || isnumeric(x) );