how p(:,j) differs from p(j,:)?

I often see people using these,
how p(:,j) differs from p(j,:)?

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 12 月 27 日
編集済み: Azzi Abdelmalek 2012 年 12 月 27 日

0 投票

p=[1 2;3 4;5 6]
check this
p(:,2)
p(3,:)
p(:,2) means all lines, column number 2, p(3,:) means all columns, line number 3

1 件のコメント

Hajar ALSHOUFI
Hajar ALSHOUFI 2019 年 9 月 4 日
if we have n points =21
I saw a code the author wrote:
p(ny,:) where p is some matrix, how can we understad it, I know the first one refers to rows and the second for columns but how can we understand it what rows is he speaking about

サインインしてコメントする。

その他の回答 (1 件)

Wayne King
Wayne King 2012 年 12 月 27 日
編集済み: Wayne King 2012 年 12 月 27 日

0 投票

p(:,j) takes all the rows and the j-th column of p
p(j,:) takes the j-th row and all the columns of p
So
p = [1 2; 3 4];
j = 1;
p(j,:)
p(:,j)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by