Previous Up Next

5.49.14  Extract rows or columns of a matrix (Maple compatibility): row col

row (resp. col) extracts one or several rows (resp. columns) of a matrix.
row (resp. col) takes 2 arguments: a matrix A, and an integer n or an interval n1..n2.
row (resp. col) returns the row (resp. column) of index n of A, or the sequence of rows (resp. columns) of index from n1 to n2 of A.
Input:

row([[1,2,3],[4,5,6],[7,8,9]],1)

Output:

[4,5,6]

Input:

row([[1,2,3],[4,5,6],[7,8,9]],0..1)

Output:

([1,2,3],[4,5,6])

Input:

col([[1,2,3],[4,5,6],[7,8,9]],1)

Output:

[2,5,8]

Input:

col([[1,2,3],[4,5,6],[7,8,9]],0..1)

Output:

([1,4,7,[2,5,8])

Previous Up Next