フィルターのクリア

how to know the indices of multiple max values?

22 ビュー (過去 30 日間)
Jaybee
Jaybee 2013 年 10 月 1 日
hi there!
I'm having problem about identifying the indices(position) of a multiple max values.
example of input:
A=[4 5 9 9]
how can i know the indices of those 9's?

採用された回答

Wayne King
Wayne King 2013 年 10 月 1 日
編集済み: Wayne King 2013 年 10 月 1 日
One way:
A = [4 5 9 9];
maxval = max(A);
lia = ismember(A,maxval);
idx = find(lia);
or shorter
maxval = max(A);
idx = find(A == maxval);
  2 件のコメント
Jaybee
Jaybee 2013 年 10 月 1 日
thank you so much bro :)
vimal kumar chawda
vimal kumar chawda 2021 年 7 月 9 日
what if we have matrix?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by