Skip to content
Algo Trade Analytics Docs

matrix.col() - Pine Script Function

The function creates a one-dimensional array from the elements of a matrix column.

matrix.col(id, column) → array<type>
NameTypeDescription
idany matrix typeA matrix object.

An array ID containing the column values of the id matrix.

  • Indexing of rows starts at 0.
//@version=6
indicator("`matrix.col()` Example", "", true)// Create a 2x3 "float" matrix from `hlc3` values.m = matrix.new<float>(2, 3, hlc3)// Return an array with the values of the first column of matrix `m`.a = matrix.col(m, 0)// Plot the first value from the array `a`.
plot(array.get(a, 0))