필터 지우기
필터 지우기

how to know the indices of multiple max values?

조회 수: 22 (최근 30일)
Jaybee
Jaybee 2013년 10월 1일
댓글: vimal kumar chawda 2021년 7월 9일
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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by