Function Reference


_ArrayMax

Returns the highest value held in a 1D or 2D array

#include <Array.au3>
_ArrayMax ( Const ByRef $aArray [, $iCompNumeric = 0 [, $iStart = -1 [, $iEnd = -1 [, $iSubItem = 0]]]] )

Parameters

$aArray Array to search
$iCompNumeric [optional] Comparison method:
    0 - compare alphanumerically
    1 - compare numerically
$iStart [optional] Index of array to start search
$iEnd [optional] Index of array to end search
$iSubItem [optional] Column of array to search

Return Value

Success: the maximum value in the array.
Failure: sets the @error flag to non-zero (see _ArrayMaxIndex() description for @error).

Related

_ArrayMaxIndex, _ArrayMin, _ArrayMinIndex, _ArrayUnique

Example

#include <Array.au3>
#include <MsgBoxConstants.au3>

Local $aArray = StringSplit("4,2,06,8,12,5", ",")

MsgBox($MB_SYSTEMMODAL, 'Max String value', _ArrayMax($aArray, 0, 1))
MsgBox($MB_SYSTEMMODAL, 'Max Numeric value', _ArrayMax($aArray, 1, 1))

Local $aArray[4][4]
For $i = 0 To 3
        For $j = 0 To 3
                $aArray[$i][$j] = Random(0, 99, 1)
        Next
Next
_ArrayDisplay($aArray, "2D Array")
MsgBox($MB_SYSTEMMODAL, 'Max Numeric value in column 2', _ArrayMax($aArray, 1, 0, -1, 2))