Input array, specified as a scalar, vector, matrix, or multidimensional
array.

If `A`

is complex, then `max(A)`

returns
the complex number with the largest magnitude. If magnitudes are
equal, then `max(A)`

returns the value with the largest
magnitude and the largest phase angle.

If `A`

is a scalar, then `max(A)`

returns `A`

.

If `A`

is a 0-by-0 empty array, then `max(A)`

is
as well.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

| `logical`

| `categorical`

| `datetime`

| `duration`

**Complex Number Support: **Yes

Dimension
to operate along, specified as a positive integer scalar. If no value
is specified, then the default is the first array dimension whose
size does not equal 1.

Dimension `dim`

indicates the dimension whose
length reduces to `1`

. The `size(M,dim)`

is `1`

,
while the sizes of all other dimensions remain the same, unless `size(A,dim)`

is `0`

.
If `size(A,dim)`

is `0`

, then `max`

returns
an empty array with the same dimension sizes.

Consider a two-dimensional input array, `A`

:

If `dim = 1`

, then `max(A,[],1)`

returns
a row vector containing the largest element in each column.

If `dim = 2`

, then `max(A,[],2)`

returns
a column vector containing the largest element in each row.

`max`

returns `A`

if `dim`

is
greater than `ndims(A)`

.

Additional input array, specified as a scalar, vector, matrix,
or multidimensional array.

The dimensions of `A`

and `B`

must
match, or one can be a scalar.

`A`

and `B`

can
be the same data type or one can be `double`

with
the other `single`

, `duration`

,
or any integer data type.

If `A`

and `B`

are
ordinal categorical arrays, they must have the same sets of categories
with the same order.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

| `logical`

| `categorical`

| `datetime`

| `duration`

**Complex Number Support: **Yes

`NaN`

condition, specified as one of these
values:

The `max`

function does not support the `nanflag`

option
for `datetime`

, `duration`

, or `categorical`

arrays.

**Data Types: **`char`