Documentation

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.

max (DataMatrix)

Return maximum values in DataMatrix object

Syntax

M = max(DMObj1)
[M, Indices] = max(DMObj1)
[M, Indices, Names] = max(DMObj1)
... = max(DMObj1, [], Dim)
MA = max(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 maximum values. Choices are:

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

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

Output Arguments

M

One of the following:

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

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

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

Indices

Either of the following:

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

  • Vector containing the indices for the maximum 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 maximum value in each column or each row of a DataMatrix object.

MA

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

  • Two DataMatrix objects

  • A DataMatrix object and a numeric array

Description

M = max(DMObj1) returns the maximum 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 maximum value in each column.

[M, Indices] = max(DMObj1) returns Indices, the indices of the maximum 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 maximum value in each column (if Dim = 1) or row (if Dim = 2). If there are multiple maximum values in a column or row, the index for the first value is returned.

[M, Indices, Names] = max(DMObj1) returns Names, a vector of the row names (if Dim = 1) or column names (if Dim = 2) corresponding to the maximum value in each column or each row ofDMObj1, a DataMatrix object. If there are multiple maximum values in a column or row, the row or column name for the first value is returned.

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

MA = max(DMObj1, DMObj2) returns MA, a numeric array containing the larger 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.

See Also

| |

Introduced in R2008b

Was this topic helpful?