cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Extract non-consecutive rows and columns from a matrix

sfan
1-Newbie

Extract non-consecutive rows and columns from a matrix

Hi, everyone,

Suppose I have a 13 by 13 matrix, (shown in attachment),

what I want to do is to extract its 4th-5th, 7th, 9th-10th rows and columns to create a 5 by 5 matrix.

So far I only know that the function "submatrix" works with extracting consecutive rows and columns,

so how to extract non consecutive rows and columns?

Looking forward to hearing from you,

Thank you very much

Best

Shawn

1 ACCEPTED SOLUTION

Accepted Solutions
ValeryOchkov
24-Ruby IV
(To:sfan)

submatrix at first and than stack function!

View solution in original post

3 REPLIES 3
ValeryOchkov
24-Ruby IV
(To:sfan)

submatrix at first and than stack function!

... Columns first then rows is probably the way to do it.

Although with so few elements, it might be just as convenient to use a program to loop over the desired row and columns and build up the new matrix one element at a a time.

Stuart

RichardJ
19-Tanzanite
(To:sfan)

I would the column operator with the augment function, followed by the row operator with the stack function.

Top Tags