nanmin - Minimum ignoring NaNs

Syntax

M = nanmin(A)
M = nanmin(A,B)
M = nanmin(A,[],dim)
[M,ndx] = nanmin(...)

Description

M = nanmin(A) is the minimum computed by treating NaNs as missing values. For vectors, M is the smallest non-NaN element in A. For matrices, M is a row vector containing the minimum non-NaN element from each column. For N-dimensional arrays, nanmin operates along the first nonsingleton dimension of X.

M = nanmin(A,B) returns an array of the same size as A and B, each of whose entries is the minimum of the corresponding entries of A or B. A scalar input is expanded to an array of the same size as the other input.

M = nanmin(A,[],dim) operates along the dimension dim of X.

[M,ndx] = nanmin(...) also returns the indices of the minimum values in vector ndx.

Example

A = magic(3);
A([1 6 8]) = [NaN NaN NaN]
A =
  NaN   1   6
   3   5  NaN
   4  NaN   2

[nmin,minidx] = nanmin(A)
nmin =
   3   1   2
minidx =
   2   1   3

See Also

nanmax, nanmean, nanmedian, nanstd, nansum

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS