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

 采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2012-12-27
编辑:Azzi Abdelmalek 2012-12-27
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 个评论

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by