Access Matrix by row or column - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Access Matrix by row or column (/thread-9797.html) Access Matrix by row or column - Stevetuc - 12-28-2017 11:26 AM Is there a command to select a specific column or row of a matrix? Ie in Matlab this works: A(3, : ) % Extract third row The colon is used as a wildcard. I cant find a way to do this on the Prime except using SUB(), but that requires you to enter lists containing start and end indices of selected region so is not as convenient as wildcarding. Actually, for a 2D Matrix, just using A(1) will select the 1st row ,but how to fo this for a column? I tried A(:,1) but this errors. RE: Access Matrix by row or column - Arno K - 12-28-2017 11:38 AM col(M,n) and row (M,n) will do the job. RE: Access Matrix by row or column - Stevetuc - 12-28-2017 11:48 AM (12-28-2017 11:38 AM)Arno K Wrote:  col(M,n) and row (M,n) will do the job. Thanks, I should have checked the catalog! RE: Access Matrix by row or column - salvomic - 12-28-2017 11:49 AM (12-28-2017 11:38 AM)Arno K Wrote:  col(M,n) and row (M,n) will do the job. yes. The Help mentions also the possibility to use an interval, but it doesn't give examples how to input the interval (both for row and cols)... You can also use some code like this one to get a "minor" (giving the row and col to delete: i.e. using minor(2,3) in a 3x3 matrix deletes row 2 and col 3 and returns a matrix with (1,1), (1,2), (3,1), (3,2) ... Code: ``` #cas // Minor of a matrix // r row, c col to delete minor(m, r,c) := BEGIN   m:= delrows(m,r);   m:= delcols(m,c);   RETURN m; END; #end``` Salvo EDIT: how should input the interval in row() and col() in Home? In CAS it's ok row(M2,2..3), a standard way to input an interval: why not implement it also in Home? RE: Access Matrix by row or column - JMB - 12-28-2017 08:19 PM (12-28-2017 11:26 AM)Stevetuc Wrote:  ..... Actually, for a 2D Matrix, just using A(1) will select the 1st row ,but how to fo this for a column? I tried A(:,1) but this errors. You can use negative values to select columns: A(-1) selects the 1st column RE: Access Matrix by row or column - Stevetuc - 12-29-2017 02:45 PM (12-28-2017 08:19 PM)JMB Wrote:   (12-28-2017 11:26 AM)Stevetuc Wrote:  ..... Actually, for a 2D Matrix, just using A(1) will select the 1st row ,but how to fo this for a column? I tried A(:,1) but this errors. You can use negative values to select columns: A(-1) selects the 1st column Thanks, thats concise syntax!