Sidechair

matrix.remove_col()

Browse the reference

Deletes a column from a matrix and returns it as an array.

Try it in the editor

The columns to the right shift one place left. Without a column index the last column is removed.

The removed column is returned as an array, so it can be kept or inspected.

Syntax

Pine Script
matrix.remove_col(id: any matrix type, column: series int (optional)) -> array<>
matrix.remove_col(column: series int (optional)) -> array<>

Arguments

NameTypeDefaultDescription
idany matrix typerequiredThe matrix to take a column out of. Its column count drops by one.
columnseries intthe last columnIndex of the column. Counts from 0.

Returns

array<>: An array holding the removed column.

Example

Pine ScriptDrop the first columnOpen in editor
//@version=6
indicator("matrix.remove_col: drop first", overlay = false)
matrix<float> m = matrix.new<float>(2, 3, 1.0)
matrix.remove_col(m, 0)
plot(matrix.columns(m), "Columns left")

See also

Runs on Sidechair