How to calculate argument max for a vector

10 visualizaciones (últimos 30 días)
Hazim Nasir
Hazim Nasir el 9 de Ag. de 2018
Comentada: Hazim Nasir el 9 de Ag. de 2018
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]

Respuesta aceptada

James Tursa
James Tursa el 9 de Ag. de 2018
Editada: James Tursa el 9 de Ag. de 2018
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)

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by