This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Minimum ignoring NaN values


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


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.


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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

| |

Introduced before R2006a

Was this topic helpful?