find the 3 maximum elements and their index
조회 수: 2 (최근 30일)
이전 댓글 표시
hi everyone, i have a vector and i need to find the 3 maximum elements and their index, plz can anyone help me in that? thx
댓글 수: 0
채택된 답변
추가 답변 (1개)
Jonathan Sullivan
2012년 2월 29일
r = rand(100,1);
[val ind] = sort(r,'descend');
val(1:3)
ind(1:3)
r(ind(1:3))
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!