Main Content

min

Return minimum values in DataMatrix object

Syntax

M = min(DMObj1)
[M, Indices] = min(DMObj1)
[M, Indices, Names] = min(DMObj1)
... = min(DMObj1, [], Dim)
MA = min(DMObj1, DMObj2)

Input Arguments

DMObj1, DMObj2

DataMatrix objects, such as created by DataMatrix (object constructor).

Note

DMObj1 and DMObj2 must be the same size, unless one is a scalar.

Dim

Scalar specifying the dimension of DMObj to return the minimum values. Choices are:

  • 1 — Default. Returns a row vector containing a minimum value for each column.

  • 2 — Returns a column vector containing a minimum value for each row.

Output Arguments

M

One of the following:

  • Scalar specifying the minimum value in DMObj when it contains vector of data

  • Row vector containing the minimum value for each column in DMObj (when Dim = 1)

  • Column vector containing the minimum value for each row in DMObj (when Dim = 2)

Indices

Either of the following:

  • Positive integer specifying the index of the minimum value in a DataMatrix object containing a vector of data

  • Vector containing the indices for the minimum value in each column (if Dim = 1) or row (if Dim = 2) in a DataMatrix object containing a matrix of data

Names

Vector of the row names (if Dim = 1) or column names (if Dim = 2) corresponding to the minimum value in each column or each row of a DataMatrix object.

MA

Numeric array created from the minimum elements in either of the following:

  • Two DataMatrix objects

  • A DataMatrix object and a numeric array

Description

M = min(DMObj1) returns the minimum value(s) in DMObj1, a DataMatrix object. If DMObj1 contains a vector of data, M is a scalar. If DMObj1 contains a matrix of data, M is a row vector containing a minimum value in each column.

[M, Indices] = min(DMObj1) returns Indices, the indices of the minimum value(s) in DMObj1, a DataMatrix object. If DMObj1 contains a vector of data, Indices is a positive integer. If DMObj1 contains a matrix of data, Indices is a vector containing the indices for the minimum value in each column (if Dim = 1) or row (if Dim = 2). If there are multiple minimum values in a column or row, the index for the first value is returned.

[M, Indices, Names] = min(DMObj1) returns Names, a vector of the row names (if Dim = 1) or column names (if Dim = 2) corresponding to the minimum value in each column or each row ofDMObj1, a DataMatrix object. If there is more than one minimum value in a column or row, the row or column name for the first value is returned.

... = min(DMObj1, [], Dim) specifies which dimension to return the minimum values for, that is each column or each row in a DataMatrix object. If Dim = 1, returns M, a row vector containing the minimum value in each column. If Dim = 2, returns M, a column vector containing the minimum value in each row. Default Dim = 1.

MA = min(DMObj1, DMObj2) returns MA, a numeric array containing the smaller of the two values from each position of DMObj1 and DMObj2. DMObj1 and DMObj2 can both be DataMatrix objects, or one can be a DataMatrix object and the other a numeric array. They must be the same size, unless one is a scalar. MA has the same size (number of rows and columns) as the first nonscalar input.

Version History

Introduced in R2008b