y = min(X)[y,i] = min(X)C = min(A,B)
min(X), where X is a vector, is the smallest element in X. For matrices, min(X) is a row vector containing the minimum element from each column and min(min(X)) is the smallest element in the entire matrix.
[y,i] = min(X) stores the indices of the minimum values in vector i. If there are several identical minimum values, the index of the first one found is returned.
C = min(A,B) returns a matrix the same size as A and B with the smallest elements taken from A or B.
For complex input X, min returns the complex number with the smallest modulus, computed with min(abs(X)).
For matrices, if a column of X contains a NaN, the element of the answer corresponding to that column will be NaN.
For vectors, if any element of X is NaN, the answer will be NaN.
A = magic(3)
ThenA =8 1 63 5 74 9 2
min(A) is the vector
3 1 2
and min(min(A)) is the scalar
1
Furthermore, [m,i] = min(A) produces
m =3 1 2i =2 1 3
isnan,max,sort
(c) Copyright 1994 by The MathWorks, Inc.