nanmax
(Not recommended) Maximum, ignoring NaN
values
nanmax
is not recommended. Use the MATLAB® function max
instead. With the max
function, you can specify whether
to include or omit NaN
values for the calculation. For more information,
see Version History.
Syntax
Description
y = nanmax(X)
is the maximum max
of X
, computed after removing NaN
values.
For vectors x
, nanmax(x)
is the maximum of the
remaining elements, once NaN
values are removed. For matrices
X
, nanmax(X)
is a row vector of column maxima,
once NaN
values are removed. For multidimensional arrays
X
, nanmax
operates along the first nonsingleton
dimension.
y = nanmax(X,[],dim)
operates along the dimension
dim
of X
.
[y,indices] = nanmax(___)
also
returns the row indices of the maximum values for each column in the vector
indices
.
y = nanmax(X,[],'all')
returns the maximum of all elements of
X
, computed after removing NaN
values.
y = nanmax(X,[],vecdim)
returns the maximum over the dimensions
specified in the vector vecdim
, computed after removing
NaN
values. Each element of vecdim
represents a
dimension of the input array X
. The output y
has
length 1 in the specified operating dimensions. The other dimension lengths are the same
for X
and y
. For example, if X
is
a 2-by-3-by-4 array, then nanmax(X,[],[1 2])
returns a 1-by-1-by-4
array. Each element of the output array is the maximum of the elements on the
corresponding page of X
.
Y = nanmax(X1,X2)
returns an array Y
the same
size as X1
and X2
with Y(i,j) =
nanmax(X1(i,j),X2(i,j))
. Scalar inputs are expanded to an array of the same
size as the other input.