简体   繁体   English

在 OCTAVE 中从矩阵 A 制作第一、第四和第五行第一和第五列的矩阵 B

[英]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 =我有矩阵 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?我需要从矩阵 A 中制作第一、第四和第五行以及第一和第五列的矩阵 B。我该怎么做?

>> 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.您应该查看如何使用 Matlab 和 Octave 语言中的索引表达式来提取和处理子矩阵。

See the Octave help on Index expressions: https://octave.org/doc/latest/Index-Expressions.html请参阅有关索引表达式的 Octave 帮助: https : //octave.org/doc/latest/Index-Expressions.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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