max
The maximum elements of the array.
| Library |
|
Syntax
Function call
-
M = max(A)— returns the maximum elements of the array.-
If
A— the matrix, thenmax(A)— vector-a row containing the maximum value of each columnA. -
If
A— a multidimensional array, thenmax(A)it operates on the first dimensionA, the size of which is not equal to1considering the elements as vectors. SizeMin this dimension , it becomes equal to1, while the dimensions of all other dimensions remain the same as inA. IfA— an empty array, the first dimension of which has zero length, thenM— an empty array of the same size asA.
-
M = max(A, [], _, missingflag)— also specifies how to handle missing values for any of the previous syntax options. For example,max(A,[],"includenan")includes all missing values when calculating the maximum. By defaultmaxexcludes missing values.
-
C = max(A, B, missingflag)— also specifies how to handle missing values.
Arguments
Input arguments
# A — input data
+
scalar | vector | the matrix | multidimensional array
Details
Input data specified as a scalar, vector, matrix, or multidimensional array.
-
If
Ais a complex number, thenmax(A)returns the complex number with the smallest absolute value. If the values are equal, thenmax(A)returns the value with the smallest absolute value and the smallest phase angle. -
If
A— a scalar, thenmax(A)returnsA. -
If
A— an empty array of size0on0Thenmax(A)it will also be an empty array.
| Типы данных |
|
| Support for complex numbers |
Yes |
# dim — the measurement for which the operation is performed
+
scalar
Details
The dimension on which the operation is performed is set as a positive integer scalar. If no dimension is specified, then the first dimension of the array is used by default, the size of which is not equal to 1.
Dimension dim specifies a dimension whose length is reduced to 1. Size size(M, dim) equal to 1 while the dimensions of all other dimensions remain the same, unless size(A, dim) not equal to 0. If size(A, dim) equal to 0, then the function max(A, dim) returns an empty array of the same size as A.
Consider the input matrix A size on :
# vecdim — measurement vector
+
vector
Details
A vector of dimensions defined as a vector of positive integers. Each element represents a dimension of the input array. The length of the output data in the specified operating measurements is 1, while the other dimensions remain unchanged.
Consider the input array A size 2×3×3. Then max(A,0,[1 2]) returns an array of size 1×1×3, the elements of which are the maximum values calculated for each layer A.
# missingflag — condition for missing a value
+
"omitnan" (by default) | "includenan"
Details
The condition for missing a value, set as:
-
"includenan"takes into account missing values in the input data. If any element is missing in the working dimension, then the corresponding element in theMalso missing. -
"omitnan"ignores the missing values in the input data and calculates the maximum from a smaller number of points. If all the elements in the working dimension are missing, then the corresponding elements inMalso missing.
# B — additional input data
+
scalar | vector | the matrix | multidimensional array
Details
Additional input data, specified as a scalar, vector, matrix, or multidimensional array. Input data A and B they must be the same size or have compatible sizes (for example, A — matrix size on , and B — a scalar or vector string of the size 1 on ).
-
If
AandB— arrays, then they must have the same data type, except when one of them is a typeFloat64. In this case, the data type of the other array may beFloat32or any integer type.
| Типы данных |
|
| Support for complex numbers |
Yes |
# method — comparison method
+
"auto" (by default) | "real" | "abs"
Details
The comparison method for the input data, specified by one of the following values:
-
"auto"— forAcompare elements by valuereal(A)ifAa real number, and by valueabs(A)ifAcomprehensive. -
"real"— forAcompare elements by valuereal(A)ifAreal or complex. If the elementsAif they have equal real parts, then the function is used to resolve the matchesimag(A). -
"abs"— forAcompare elements by valueabs(A)ifAreal or complex. If the elementsAif they have equal absolute values, then the function is used to resolve the matchesangle(A)in the interval .
Output arguments
# M — maximum values
+
scalar | vector | the matrix | multidimensional array
Details
The maximum values returned as a scalar, vector, matrix, or multidimensional array. Size size(M,dim) equal to 1, while the dimensions of all other dimensions match the size of the corresponding dimension in A if size(A,dim) not equal to 0. If size(A,dim) equal to 0 Then M — an empty array of the same size as A.
# I — index
+
scalar | vector | the matrix | multidimensional array
Details
The index returned as a scalar, vector, matrix, or multidimensional array. Argument I it has the same size as the first output parameter.
If the call does not specify "linear" Then I — this is the index of the working measurement. If the call specifies "linear" Then I contains linear indexes A, corresponding to the maximum values.
If the smallest element occurs more than once, then I contains the index of the first occurrence of the value.