matrix.concat() - Pine Script Function
matrix.concat()
Section titled “matrix.concat()”Overview
Section titled “Overview”The function appends the m2 matrix to the m1 matrix.
Syntax
Section titled “Syntax”matrix.concat(id1, id2) → matrix<type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id1 | any matrix type | Matrix object to concatenate into. |
Returns
Section titled “Returns”Returns the id1 matrix concatenated with the id2 matrix.
Remarks
Section titled “Remarks”- The number of columns in both matrices must be identical.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("`matrix.concat()` Example")// Create a 2x4 "int" matrix containing values `0`.m1 = matrix.new<int>(2, 4, 0)// Create a 2x4 "int" matrix containing values `1`.m2 = matrix.new<int>(2, 4, 1)// Append matrix `m2` to `m1`.matrix.concat(m1, m2)// Display matrix elements.if barstate.islastconfirmedhistoryvar t = table.new(position.top_right, 2, 2, color.green)table.cell(t, 0, 0, "Matrix Elements:")table.cell(t, 0, 1, str.tostring(m1))