| Statistics Toolbox | Search  Help Desk |
| nanmax | Examples See Also |
Syntax
m = nanmax(a) [m,ndx] = nanmax(a) m = nanmax(a,b)
Description
m = nanmax(a) returns the maximum with NaNs treated as missing. For vectors, nanmax(a) is the largest non-NaN element in a. For matrices, nanmax(A) is a row vector containing the maximum non-NaN element from each column.
[m,ndx] = nanmax(a) also returns the indices of the maximum values in vector ndx.
m = nanmax(a,b) returns the larger of a or b, which must match in size.
Example
m = magic(3);m([1 6 8]) = [NaN NaN NaN]m =NaN 1 63 5 NaN4 NaN 2[nmax,maxidx] = nanmax(m)nmax =4 5 6maxidx =3 2 1
See Also
nanmin,nanmean,nanmedian,nanstd,nansum