# max

Maximum elements of an array

## Syntax

## Description

returns the maximum elements of an array.`M`

= max(`A`

)

If

`A`

is a vector, then`max(A)`

returns the maximum of`A`

.If

`A`

is a matrix, then`max(A)`

is a row vector containing the maximum value of each column.If

`A`

is a multidimensional array, then`max(A)`

operates along the first array dimension whose size does not equal`1`

, treating the elements as vectors. The size of this dimension becomes`1`

while the sizes of all other dimensions remain the same. If`A`

is an empty array whose first dimension has zero length, then`max(A)`

returns an empty array with the same size as`A`

.

`___ = max(___,'ComparisonMethod',`

optionally specifies how to compare elements for any of the previous syntaxes.
For example, for a vector `method`

)`A = [-1 2 -9]`

, the syntax
`max(A,[],'ComparisonMethod','abs')`

compares the elements
of `A`

according to their absolute values and returns
`-9`

.

## Examples

## Input Arguments

## Output Arguments

## Extended Capabilities

**Introduced before R2006a**