max
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 Note
|
Dim | Scalar specifying the dimension of
|
Output Arguments
M | One of the following:
|
Indices | Either of the following:
|
Names | Vector of the row names (if |
MA | Numeric array created from the maximum elements in either of the following:
|
Description
returns
the maximum value(s) in M
= max(DMObj1
)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.
[
returns M
, Indices
]
= max(DMObj1
)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.
[
returns M
, Indices
, Names
]
= max(DMObj1
)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(
specifies which dimension
to return the maximum values for, that is each column or each row
in a DataMatrix object. If DMObj1
,
[], Dim
)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
.
returns MA
= max(DMObj1
, DMObj2
)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.
Version History
Introduced in R2008b
See Also
DataMatrix
| min
| sum