function y = minmax(x)
%
% MINMAX      find the minimum and maximum of a vector or a matrix
%             Robust with respect to NaN.
%
% USAGE       MINMAX(x)
%
%  Deirdre Byrne: 18 Jan 1995

% The preceding empty line is important.
%
% $Id: minmax.m,v 1.7 1998/11/09 20:19:23 dbyrne Exp $

% $Log: minmax.m,v $
% Revision 1.7  1998/11/09 20:19:23  dbyrne
% *** empty log message ***
%
% Revision 1.1  1998/05/17 14:10:51  dbyrne
% *** empty log message ***
%
% Revision 1.1.1.1  1997/09/22 14:13:53  tom
% Imported Matlab GUI sources to CVS
%

if nargin == 1
  if any(any(isnan(x)))
    i = find(~isnan(x));
    if ~isempty(i)
      y = [min(min(x(i))) max(max(x(i)))];
    else
      y = [nan nan];
    end
  else
    y = [min(min(x)) max(max(x))];
  end
end
clear x i
