MAX

The MAX function returns the value of the largest element of Array . The type of the result is the same as the type of Array .

Calling Sequence

Result = MAX( Array [, Max_Subscript] )

Arguments

Array

The array to be searched.

Max_Subscript

A named variable that, if supplied, is converted to a long integer containing the one-dimensional subscript of the maximum element. Otherwise, the system variable !C is set to the one-dimensional subscript of the maximum element.

Keywords

MIN

A named variable to receive the value of the minimum array element. If you need to find both the minimum and maximum array values, use this keyword to avoid scanning the array twice with separate calls to MAX and MIN.

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. (See Special Floating-Point Values for more information on IEEE floating-point values.)

Example

Create a simple two-dimensional array by entering:

D = DIST(100)

Print the maximum value in array D and its linear subscript by entering:

PRINT, MAX(D, I), I

IDL prints:

  70.7107   5050

To convert I to a two-dimensional subscript, use the commands:

IX = I MOD 100

IY = I/100

PRINT, IX, IY

The maximum value of D is at location (50, 50) in the original array.

See Also

MIN