Referring to multiple columns

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 日

5 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

-
-
2015 年 9 月 10 日

編集済み:

-
-
2016 年 3 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by