简体   繁体   中英

Make a matrix B of the first, fourth and fifth row and the first and fifth column from matrix A in OCTAVE

I have matrix AA =

 5    10    15    20    25
10     9     8     7     6
-5   -15   -25   -35   -45
 1     2     3     4     5
28    91   154   217   280

And i need to make a matrix B of the first, fourth and fifth row and the first and fifth column from matrix A. How can i do it?

>> B = A([1,4,5],[1,5])
B =
 5      25
 1       5
28     280

You should look up how to use index expressions in the Matlab and Octave language to extract and work with submatrices.

See the Octave help on Index expressions: https://octave.org/doc/latest/Index-Expressions.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM