Returns the largest item in a matrix.
The whole grid is searched, not one row or column: [[1, 9], [4, 2]] gives 9. An all-na matrix gives na.
Use matrix.row() or matrix.col() with array.max() to find the largest item in a single line.
Syntax
matrix.max(id: matrix<int/float>) -> series float
matrix.max(id: matrix<int>) -> series int
matrix.max() -> series float
matrix.max() -> series intArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | matrix<int/ | required | The matrix searched in full for its largest item, across every row and column. |
Returns
series float: The largest item as a float.series int: The largest item as a whole number, to match an integer matrix.series float: The largest item of the receiving matrix as a float.series int: The largest item of the receiving matrix as a whole number.
Example
//@version=6
indicator("matrix.max: peak", overlay = false)
matrix<float> m = matrix.new<float>(2, 2, 1.0)
matrix.set(m, 1, 0, 8.0)
plot(matrix.max(m), "Largest")See also
Runs on Sidechair