NCL Home > Documentation > Functions > Array query

maxind

Returns the index of the first occurrence of a maximum value.

Prototype

	function maxind (
		arg [*] : numeric   
	)

	return_val [1] :  integer

Arguments

arg

A one-dimensional numeric array.

Description

This function scans an array for the maximum value and returns the index of the first occurrence of it. Missing values are ignored. Remember that in NCL, indexing starts at 0, not 1.

See Also

minind, min, max

Examples

Example 1

   x = (/3.,2.,5.,1.,5.,2.,5.,1.,3.,2./)
   i = maxind(x)                           ; Should be 2.