필터 지우기
필터 지우기

find the 3 maximum elements and their index

조회 수: 2 (최근 30일)
amal
amal 2012년 2월 29일
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

채택된 답변

Srinivas
Srinivas 2012년 2월 29일
help sort

추가 답변 (1개)

Jonathan Sullivan
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
amal
amal 2012년 2월 29일
thank u very much i tried it and it worked, but i forgot to mention that i need to do it with simulink :s
Srinivas
Srinivas 2012년 3월 1일
you can use the above written code in 'MATLAB Fucntion' block

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by