nanmin
'all'
)Find the minimum while ignoring NaN values.
v = nanmin (x)
returns the minimum of x, after
removing NaN
values. If x is a vector, a scalar minimum value
is returned. If x is a matrix, a row vector of column maxima is
returned. If x is a multidimentional array, the nanmin
operates
along the fisrt nonsigleton dimension. If all values in a column are
NaN
, the minimum is returned as NaN
rather than []
.
v = nanmin (x, [], dim)
operates along the dimension
dim of x.
[v, idx] = nanmin (…)
also returns the row indices
of the minimum values for each column in the vector idx. When x
is a vector, then idx is a scalar value as v.
v = nanmin (x, [],
returns the minimum of
all elements of x, after removing 'all'
)NaN
values. It is the
equivalent of nanmin (x(:))
. The optional flag 'all'
cannot be used together with dim or vecdim input arguments.
v = nanmin (x, [], vecdim)
returns the minimum over
the dimensions specified in the vector vecdim. Each element of
vecdim represents a dimension of the input array x and the output
v has length 1 in the specified operating dimensions. The lengths of
the other dimensions are the same for x and y. For example, if
x is a 2-by-3-by-4 array, then nanmin (x, [1 2])
returns a
1-by-1-by-4 array. Each element of the output array is the minimum of the
elements on the corresponding page of x. If vecdim indexes all
dimensions of x, then it is equivalent to
nanmin (x,
. Any dimension in vecdim
greater than 'all'
)ndims (x)
is ignored.
Source Code: nanmin
## Find the column minimum values and their indices ## for matrix data with missing values. x = magic (3); x([1, 6:9]) = NaN [y, ind] = nanmin (x) x = NaN 1 NaN 3 5 NaN 4 NaN NaN y = 3 1 NaN ind = 2 1 1 |
## Find the minimum of all the values in an array, ignoring missing values. ## Create a 2-by-5-by-3 array x with some missing values. x = reshape (1:30, [2, 5, 3]); x([10:12, 25]) = NaN ## Find the minimum of the elements of x. y = nanmin (x, [], 'all') x = ans(:,:,1) = 1 3 5 7 9 2 4 6 8 NaN ans(:,:,2) = NaN 13 15 17 19 NaN 14 16 18 20 ans(:,:,3) = 21 23 NaN 27 29 22 24 26 28 30 y = 1 |