How to calculate argument max for a vector

조회 수: 10 (최근 30일)
Hazim Nasir
Hazim Nasir 2018년 8월 9일
댓글: Hazim Nasir 2018년 8월 9일
Hello, How I can calculate arg max for the following vector
p=[0.0061,0.0188,0.0014,0.0233,Inf,0.0130,0.0016,0.0155,0.0016,0.002,0.002,0.0032,0.0054]

채택된 답변

James Tursa
James Tursa 2018년 8월 9일
편집: James Tursa 2018년 8월 9일
Assuming "arg max" means index of the max location, use both outputs of the max function
p = your vector
[m,x] = max(p);
m will contain the max, x will contain the index location of the max (first one)

추가 답변 (0개)

카테고리

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