Deletes a column from a matrix and returns it as an array.
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
matrix.remove_col(id: any matrix type, column: series int (optional)) -> array<>
matrix.remove_col(column: series int (optional)) -> array<>Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | any matrix type | required | The matrix to take a column out of. Its column count drops by one. |
| column | series int | the last column | Index of the column. Counts from 0. |
Returns
array<>: An array holding the removed column.
Example
//@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