matrix.set() - Pine Script Function
matrix.set()
Section titled “matrix.set()”Overview
Section titled “Overview”The function assigns value to the element at the row and column of the id matrix.
Syntax
Section titled “Syntax”matrix.set(id, row, column, value) → voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any matrix type | A matrix object. |
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("`matrix.set()` Example")// Create a 2x3 "int" matrix containing values `4`.m = matrix.new<int>(2, 3, 4)// Replace the value of element at row 1 and column 2 with value `3`.matrix.set(m, 0, 1, 3)// Display using a label.if barstate.islastconfirmedhistorylabel.new(bar_index, high, str.tostring(m))