


MINMAX Simultaneous overall smallest and largest components. Y = MINMAX(X) returns the minimum and maximum values, of the array X such that Y(1) = MIN(X) and Y(2) = MAX(X). For N-D arrays X, MINMAX(X) is equivalent to MINMAX(X(:)). [Y,I] = MINMAX(X) also returns the linear indices of the extrema such that, Y(1) == X(I(1)) and Y(2) == X(I(2)). When X has more than one extremal element, the index of the first is returned. X must be a real, double array. NaN's are ignored.


0001 function [extrema,inds] = minmax(X) 0002 %MINMAX Simultaneous overall smallest and largest components. 0003 % Y = MINMAX(X) returns the minimum and maximum values, of the array X 0004 % such that Y(1) = MIN(X) and Y(2) = MAX(X). For N-D arrays X, 0005 % MINMAX(X) is equivalent to MINMAX(X(:)). 0006 % 0007 % [Y,I] = MINMAX(X) also returns the linear indices of the extrema such 0008 % that, Y(1) == X(I(1)) and Y(2) == X(I(2)). When X has more than one 0009 % extremal element, the index of the first is returned. 0010 % 0011 % X must be a real, double array. NaN's are ignored. 0012 0013 %%%%% Argument checking. 0014 if (~strcmp(class(X), 'double') || ~isreal(X)), 0015 error('X must be a real, double array.'); 0016 end; 0017 0018 [extrema(1),extrema(2),inds(1),inds(2)] = CORE_minmax(X(:)); 0019