|
Contents | Previous | Next | Subchapters |
| Syntax |
matrix.row(starting index, number)matrix.col(starting index, number)
|
| See Also | base , one row or column , and non-sequential rows or columns |
x = {[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]}
x.row(1, 2)
O-Matrix will respond
[ 1 , 2 , 3 , 4 ]
[ 5 , 6 , 7 , 8 ]
If you then enter
x.col(1, 2)
O-Matrix will respond
{
[ 1 , 2 ]
[ 5 , 6 ]
[ 9 , 10 ]
}
You can also use .row and .col to assign a submatrix.
The result will have the type that corresponds to coercion
between the type of the original matrix and the submatrix.
Continuing the previous example, if you enter
x.col(3, 2) = fill(5.5, 3, 2)
print type(x), x
O-Matrix will respond
real {
[ 1 , 2 , 5.5 , 5.5 ]
[ 5 , 6 , 5.5 , 5.5 ]
[ 9 , 10 , 5.5 , 5.5 ]
}