function IdxRemove = utFindTsTimeUnitFromArgs(remArgs)
% Find index of Ts and TimeUnit name-value pairs if they exist

% Copyright 2023 The MathWorks, Inc.

IdxRemove = [];
IdxTs = idpack.findOptionInList('Ts',remArgs,2);
IdxTimeUnit = idpack.findOptionInList('TimeUnit',remArgs,5);
if ~isempty(IdxTs)
   if numel(remArgs) >= IdxTs(end) + 1
      IdxRemove = [IdxTs,IdxTs+1];
   else
      % error('Ts is not assigned a value');
      error(message('Ident:utility:TsNotAssignedAvalue'));
   end
end
if ~isempty(IdxTimeUnit)
   if numel(remArgs) >= IdxTimeUnit(end) + 1
      IdxRemove = [IdxRemove,IdxTimeUnit,IdxTimeUnit+1];
   else
      % error('TimeUnit is not assigned a value');
      error(message('Ident:utility:TimeUnitNotAssignedAvalue'));
   end
end
end