matrix.col() - Pine Script Function
matrix.col()
Section titled “matrix.col()”Overview
Section titled “Overview”The function creates a one-dimensional array from the elements of a matrix column.
Syntax
Section titled “Syntax”matrix.col(id, column) → array<type>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| id | any matrix type | A matrix object. |
Returns
Section titled “Returns”An array ID containing the column values of the id matrix.
Remarks
Section titled “Remarks”- Indexing of rows starts at 0.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("`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))