NV5 GEOSPATIAL SOFTWARE
>  Docs Center  >  Libraries  >  ASTROLIB  >  MINMAX

MINMAX

MINMAX

## Purpose

Return a 2 element array giving the minimum and maximum of an array

## Explanation

Using MINMAX() is faster than doing a separate MAX and MIN.
The procedure MAXMIN in http://www.idlcoyote.com/programs/maxmin.pro
has a similar purpose but uses a procedure call rather than a function.

## Calling Sequence

value = minmax( array, [subs, /NAN, DIMEN= ] )

## Inputs

array - an IDL numeric scalar, vector or array.

## Outputs

value = a two element vector (if DIMEN is not supplied)
value[0] = minimum value of array
value[1] = maximum value of array
If the DIMEN keyword is supplied then value will be a 2 x N element
array where N is the number of elements in the specified
dimension

## Optional Output Parameter

subs - two-dimensional vector; the first element gives the subscript
of the minimum value, the second element gives the subscript
of the maximum value.

## Optional Input Keyword

/NAN - Set this keyword to cause the routine to check for occurrences
of the IEEE floating-point value NaN in the input data. Elements
with the value NaN are treated as missing data.
DIMEN - integer (either 1 or 2) specifying which dimension of a 2-d
array to take the minimum and maximum. Note that (unlike the
DIMENSION keyword to the MIN() function) DIMEN is only valid
for a 2-d array, larger dimensions are not supported.

## Example

(1) Print the minimum and maximum of an image array, im

IDL> print, minmax( im )
(2) Given a 2-dimension array of (echelle) wavelengths w, print the
minimum and maximum of each order
print,minmax(w,dimen=1)

## Procedure

The MIN function is used with the MAX keyword

## Revision History

Written W. Landsman January, 1990
Added NaN keyword. M. Buie June 1998
Added DIMEN keyword W. Landsman January 2002
Added SUBSCRIPT_MIN and SUBSCRIPT_MAX BT Jan 2005
Added optional subs output parameter W. Landsman July 2009

© 2024 NV5 Geospatial Solutions, Inc. |  Legal