% function [out,minimum,maximum]=range(x)
%
% routine to find min and max of elements with NaN
%
function [out,minimum,maximum]=rangejm(x)

t=length(find(isnan(x)==1));

if t>0;
  minimum=min(x(find(isnan(x)~=1)));
  maximum=max(x(find(isnan(x)~=1)));
  disp([' Includes ',num2str(t),' NaNs.']);
else;
  minimum=min(x);
  maximum=max(x);
end;


%
out=maximum-minimum;