Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

nanmin - Minimum ignoring NaN values

Syntax

y = nanmin(X)
Y = nanmin(X1,X2)
y = nanmin(X,[],dim)
[y,indices] = nanmin(...)

Description

y = nanmin(X) is the minimum min of X, computed after removing NaN values.

For vectors x, nanmin(x) is the minimum of the remaining elements, once NaN values are removed. For matrices X, nanmin(X) is a row vector of column minima, once NaN values are removed. For multidimensional arrays X, nanmin operates along the first nonsingleton dimension.

Y = nanmin(X1,X2) returns an array Y the same size as X1 and X2 with Y(i,j) = nanmin(X1(i,j),X2(i,j)). Scalar inputs are expanded to an array of the same size as the other input.

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

[y,indices] = nanmin(...) also returns the row indices of the minimum values for each column in the vector indices.

Examples

Find column minima and their indices for data with missing values:

X = magic(3);
X([1 6:9]) = repmat(NaN,1,5)
X =
   NaN     1   NaN
     3     5   NaN
     4   NaN   NaN
[y,indices] = nanmin(X)
y =
     3     1   NaN
indices =
     2     1     1

See Also

NaN, min, nanmax

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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