I have two matricies, Q and W, and I calculated the values of Q from the values of W. I then found the maximum values of each row in Q, but I also need to find the corresponding values of W from the other matrix and I'm not sure how to do that.

 채택된 답변

Turlough Hughes
Turlough Hughes 2020년 9월 17일

1 개 추천

You can get the corresponding values in W as follows
[mQ,idx] = max(Q,[],2,'linear')
W(idx)

추가 답변 (1개)

BOB MATHEW SYJI
BOB MATHEW SYJI 2020년 9월 17일

0 개 추천

Hope this helps. yis the required vector
W=%your vector
Q=%vector obtained after operations on W
[v,u]=max(W')
for i=1:length(u)
y(i)=Q(i,u(i));
end

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2020년 9월 17일

답변:

2020년 9월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by