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)

태그

질문:

2012년 12월 27일

댓글:

2019년 9월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by