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 日

0 投票

index=find(A==max(A))
This should give you the indexes.

その他の回答 (1 件)

KSSV
KSSV 2019 年 3 月 20 日

0 投票

A = [8,5,6,7,8]
maxval = max(A);
lia = ismember(A,maxval);
idx = find(lia);

カテゴリ

ヘルプ センター および File ExchangeMatrix 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