Function Reference


_ArrayMinIndex

Returns the index where the lowest value occurs in a 1D or 2D array

#include <Array.au3>
_ArrayMinIndex ( 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 index of the minimum value in the array.
Failure: -1 and sets the @error flag to non-zero.
@error: 1 - $aArray is not an array or is empty
2 - $aArray is not a 1D or 2D array
3 - $iStart or $iEnd outside array bounds
4 - $iStart is greater than $iEnd
5 - $aArray is empty
6 - $iSubItem outside array bounds

Related

_ArrayMax, _ArrayMaxIndex, _ArrayMin

Example

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

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

MsgBox($MB_SYSTEMMODAL, 'Min Index String value', _ArrayMinIndex($aArray, 0, 1))
MsgBox($MB_SYSTEMMODAL, 'Min Index Numeric value', _ArrayMinIndex($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, 'Min Index Numeric value in column 2', _ArrayMinIndex($aArray, 1, 0, -1, 2))