How to extract two equal maximum values at different index

Hi guys,
How can I point out the different location of two maximum values
example A = [8,5,6,7,8]
If i type [max_A, index] = max(A), it will give me max = 8 and index = 1, but in this case the index must be 1 and 5.

 채택된 답변

Birdman
Birdman 2019년 3월 20일
편집: Birdman 2019년 3월 20일
index=find(A==max(A))
This should give you the indexes.

추가 답변 (1개)

KSSV
KSSV 2019년 3월 20일
A = [8,5,6,7,8]
maxval = max(A);
lia = ismember(A,maxval);
idx = find(lia);

카테고리

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

제품

릴리스

R2018b

질문:

2019년 3월 20일

답변:

2019년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by