Find the highest value and its entry of a (2xn) matrix in each column

Hello,
I have a matrix with the size of 2xn , lets fill it with random numbers:
17 23 4 10 11
24 5 6 12 18
Now I want to know the entry number of the highest value in each row (in form of a vector, 1xn) and a vector full of the values themselfes (size 1xn), which would mean for the example:
2 1 2 2 2
and
24 23 6 12 18
I have to do that for a lot of iterations build into a GUI, so I want to fasten it a bit up and stop using a for loop with if cases. Same values in both entries is mathimatically impossible.
Could someone please help me with that?
PS: The programm needs to run on Matlab version since 2013

 채택된 답변

v=[17 23 4 10 11; 24 5 6 12 18]
[a,idx]=max(v)

추가 답변 (0개)

카테고리

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

제품

질문:

2015년 6월 25일

댓글:

2015년 6월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by