HP Forums

Full Version: Taking part of a matrix.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there any way of take part of a matrix? For example in Matlab it could be A(i:j,m:n) to take from i to j rows and m to n columns.
I know that in HP Prime we could take an element of a matrix, A(i,j).
(06-30-2021 01:25 PM)Isai Wrote: [ -> ]Is there any way of take part of a matrix? For example in Matlab it could be A(i:j,m:n) to take from i to j rows and m to n columns.
I know that in HP Prime we could take an element of a matrix, A(i,j).

This operation is called "slicing" the matrix. I don't think there is anything built-in to do it, except in Python/Numpy.
Hi, try using the "SUB" command:

"SUB (Matrix, {rowA, columnA}, {rowB, columnB})".

Look at the attachment.
(06-30-2021 01:25 PM)Isai Wrote: [ -> ]Is there any way of take part of a matrix? For example in Matlab it could be A(i:j,m:n) to take from i to j rows and m to n columns.

From the section "Matrix references" in the Prime manual:
Quote:M1({{1,1},{2,2}}) extracts a sub-matrix from the element in the first row and column to the element in the second row and column.

So your Mathlab example for A(i:j,m:n) would translate on the Prime to M1({{i,m},{j,n}})
Reference URL's