function [lim_98] = lim98( array )
%[lim_lower02, lim_upper98] = lim98( array )
%   This function sorts the array and finds the limits after ignoring the
%   top 5% of data.

array = sort(array(~isnan(array)));
n = length(array);

i1 = round(n*0.02); % Lower index limit for colorbar
i2 = round(n*0.98);

lim_98(1) = array(i1); % Lower z limit for colorbar
lim_98(2) = array(i2); % Upper z limit for colorbar

end

