Get the value from coloumn correspond to the another coloimn max element
1 view (last 30 days)
Show older comments
Konstantin Shchukin
on 17 Jul 2022
Answered: Star Strider
on 17 Jul 2022
I have a matrix n x 2. In the first coloumn some value is maximal. How can I get a value from the second coloumn which corresponses to the max value from the first coloumn?
0 Comments
Accepted Answer
Star Strider
on 17 Jul 2022
Try this —
M = rand(10,2)
[Col1Max,idx] = max(M(:,1))
Result = M(idx,2)
.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!