|
Contents | Previous | Next | Subchapters |
| Syntax |
matrix.row(row index)matrix.col(column index) |
| See Also | base , matrix element , and sequential rows or columns |
x = {[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]}
x.row(2)
O-Matrix will respond
[ 5 , 6 , 7 , 8 ]
If you continue the example above by entering
x.col(3)
O-Matrix will respond
{
3
7
11
}
You can also use .row to assign a row
and .col to assign a column.
Continuing the previous example, if you type
x.row(2) = fill(3.3, 1, 4)
print type(x), x
O-Matrix will respond
real {
[ 1 , 2 , 3 , 4 ]
[ 3.3 , 3.3 , 3.3 , 3.3 ]
[ 9 , 10 , 11 , 12 ]
}
Note that the result has the type corresponding to coercion
between the type of the original matrix and the new row or column.