Description: | Returns the maximum value of all elements in an array, a set of elements in an array, or elements in a specified dimension of an array. | ||
Class: | Transformational function; Generic | ||
Arguments: | ARRAY | Must be an array of type integer or real. | |
DIM (opt) | Must be a scalar integer expression with a value in the range 1 to n, where n is the rank of ARRAY. | ||
MASK (opt) | Must be a logical array that is conformable with ARRAY. | ||
Results: | The result is an array or a scalar of the
same data type as ARRAY.
The result is a scalar if DIM is omitted or ARRAY has rank one. The following rules apply if DIM is omitted:
|
Examples
The value of MAXVAL ((/2, 3, 4/)) is 4 because that is the maximum value in the rank-one array.
MAXVAL (B, MASK=B .LT. 0.0) finds the maximum value of the negative elements of B.
C is the array
[ 2 3 4 ]
[ 5 6 7 ].
MAXVAL (C, DIM=1) has the value (5, 6, 7). 5 is the maximum value in column 1; 6 is the maximum value in column 2; and so forth.
MAXVAL (C, DIM=2) has the value (4, 7). 4 is the maximum value in row 1 and 7 is the maximum value in row 2.