indexofmax

Index of vector maximum value function.

Syntax

indexofmax(vec_expr)

Argument

vec_expr
A valid vector expression.

Example

Templex Expression Result
{indexofmax( {1, 2, 3, 2, 1} )} 2
{indexofmax( {3, 3, 3} )} 0

Comments

The indexofmax function returns the index of the maximum value of a vector. vec_expr must be a vector. The result is a scalar. The first index of a vector is zero.

If the maximum value occurs more than once in a vector, the index of the first occurrence is given.