Referring to multiple columns
조회 수: 34 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!