Contents Previous Next Subchapters Current Chapters-> vectorelem matrixelem rowcol seqrowcol seqsubvec subblock nonseq vecind endexp base colbase rowbase Parent Chapters-> Omatrix6 submatrices seqrowcol Search Tools-> contents reference index search

Accessing Sequential Rows Or Columns
 Syntax matrix.row(starting index, number) matrix.col(starting index, number) See Also base , one row or column , and non-sequential rows or columns

Description
References the submatrix starting at the specified row or column index and containing the specified number of rows or columns, where starting index and number are integer scalars. (If either starting index, or number, is real, or double-precision, it is interpreted as an integer using the same convention as in the int function. )

Tutorial
If you enter
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 ]
}