採用された回答

James Tursa
James Tursa 2017 年 6 月 15 日
編集済み: James Tursa 2017 年 6 月 15 日

5 投票

If A is a 2D matrix, then
A(3,:) is the 3rd row of A
A(:,3) is the 3rd column of A
If A is a multi-dimensional array, then a bit more explanation is required, which can be found here:
https://www.mathworks.com/help/matlab/ref/colon.html?searchHighlight=colon&s_tid=doc_srchtitle

その他の回答 (1 件)

Philip Abel
Philip Abel 2022 年 10 月 23 日

1 投票

Given a matrix "a" with elements
a = [1 2 3; 4 5 6]
To find a(x,y), it is important to note that:
  • x stands for row
  • y stands for column.
  • : stands for all
  • thus, a(x,y) is the element where x and y intersects.
  1. a(1,3) : is the element on the intersection of row 1 and column 3.
  2. a(:,3) : are the elements on the intersection of all rows and column 3.
  3. a(1,:) : are the elements on the intersection of row 1 and all columns.
a = [1 2 3; 4 5 6];
p = a(1,3)
p = 3
q = a(:,3)
q = 2×1
3 6
r = a(1,:)
r = 1×3
1 2 3

カテゴリ

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

質問済み:

2017 年 6 月 15 日

回答済み:

2022 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by