Home > chronux_1_15 > spikesort > utility > datatools > minmax.m

minmax

PURPOSE ^

MINMAX Simultaneous overall smallest and largest components.

SYNOPSIS ^

function [extrema,inds] = minmax(X)

DESCRIPTION ^

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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Tue 15-Aug-2006 22:51:57 by m2html © 2003