function newvar = fixWeirdNumericalErrors(newvar);  
%function newvar = fixWeirdNumericalErrors(newvar);  
%
% sometimes, mex function returns values that are less than realmin
% but greater than 0, this causes problems for Matlab
%

%
% NAVAL UNDERSEA WARFARE CENTER
% class-specific@npt.nuwc.navy.mil
% http://www.npt.nuwc.navy.mil/csf
% Paul M. Baggenstoss
% 401-832-8240
% Do not disseminate.
%



if iscell(newvar)
    for i = 1:length(newvar)
        newvar{i}((newvar{i} > 0.0 & newvar{i} < realmin)) = 0;
    end
elseif isnumeric(newvar)
    newvar(newvar > 0.0 & newvar < realmin) = 0;
end

