matrix.fill() - Pine Script Function
matrix.fill()
Section titled “matrix.fill()”Overview
Section titled “Overview”The function fills a rectangular area of the id matrix defined by the indices from_column to to_column (not including it) and from_row to to_row(not including it) with the value.
Syntax
Section titled “Syntax”matrix.fill(id, value, from_row, to_row, from_column, to_column) → 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.fill()` Example")// Create a 4x5 "int" matrix containing values `0`.m = matrix.new<float>(4, 5, 0)// Fill the intersection of rows 1 to 2 and columns 2 to 3 of the matrix with `hl2` values.matrix.fill(m, hl2, 0, 2, 1, 3)// Display using a label.if barstate.islastconfirmedhistorylabel.new(bar_index, high, str.tostring(m))