How to find a corresponding matrix value
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Turlough Hughes
2020-9-17
You can get the corresponding values in W as follows
[mQ,idx] = max(Q,[],2,'linear')
W(idx)
0 个评论
更多回答(1 个)
BOB MATHEW SYJI
2020-9-17
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mathematics and Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!