function numObs = incrementObservations(numObs,n) %#codegen
% INCREMENTOBSERVATIONS utility function to increment numObservations upto
% the limit allowed by the class of numObservations.

%   Copyright 2020 The MathWorks, Inc.

if ~isinteger(numObs)
    if ~(numObs == realmax(class(numObs)))
        numObs = numObs + n;
    end
else
    if intmax(class(numObs))-numObs >= n
        numObs = numObs + n;
    end    
end
end