Sidechair

matrix.concat()

Browse the reference

Appends the rows of a second matrix below the first and returns the first matrix.

Try it in the editor

Both matrices need the same number of columns. After the call the first matrix is taller by the number of rows of the second, which is not changed.

The returned value is the first matrix itself, so it can be assigned or ignored.

Syntax

Pine Script
matrix.concat(id1: any matrix type, id2: any matrix type) -> matrix<>
matrix.concat(id2: any matrix type) -> matrix<>

Arguments

NameTypeDefaultDescription
id1any matrix typerequiredThe matrix that gets the rows of the second matrix added below its own.
id2any matrix typerequiredThe matrix whose rows are added below the first.

Returns

matrix<>: The first matrix, now including the rows of the second.

Example

Pine ScriptStack two blocksOpen in editor
//@version=6
indicator("matrix.concat: stack", overlay = false)
matrix<float> top = matrix.new<float>(2, 3, 1.0)
matrix<float> bottom = matrix.new<float>(1, 3, 2.0)
matrix.concat(top, bottom)
plot(matrix.rows(top), "Rows after stacking")

See also

Runs on Sidechair