필터 지우기
필터 지우기

how to form a indexed matrix?

조회 수: 1 (최근 30일)
Shubham Mohan Tatpalliwar
Shubham Mohan Tatpalliwar 2018년 11월 26일
댓글: Jan 2018년 11월 26일
Row matrix
A=[0 2 3; 3 2 1; 2 3 1]
Column
B= 2
Index matrix
C=[10 20 50; 60 80 90 ; 20 60 40]
Result expected
i would first select colum As 2
And look for the values of C
Depending on row number from A
D=[0 80 60; 60 80 20; 80 60 20]

채택된 답변

Jan
Jan 2018년 11월 26일
The quetsion is not really clear. With some bold guessing:
A = [1 2 3; 3 2 1; 2 3 1];
B = 2;
C = [10 20 50; 60 80 90 ; 20 60 40];
CB = C(:, B);
D = CB(A)
  댓글 수: 3
Shubham Mohan Tatpalliwar
Shubham Mohan Tatpalliwar 2018년 11월 26일
Can u suggest me something for zero terms
Jan
Jan 2018년 11월 26일
D = zeros(size(A));
m = (A ~= 0);
D(m) = CB(A(m));

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by