Referring to multiple columns

34 次查看(过去 30 天)
-
- 2015-9-10
编辑: - 2016-3-12
Hi,
mat =
7 8 9 10
12 10 8 6
How can I refer to the first two columns of the matrix above? Thanks in advance.

采纳的回答

Geoff Hayes
Geoff Hayes 2015-9-10
Ahmet - if mat is your matrix, then to get the first two colums (and all rows) you could do
mat(:,1:2)
which would give you
7 8
12 10
Note how the first colon indicates that we want all rows, and the 1:2 means that we want the columns one through two.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by