how to index Vector Position

3 visualizaciones (últimos 30 días)
Nicholas Gresham
Nicholas Gresham el 19 de Ag. de 2020
Respondida: madhan ravi el 19 de Ag. de 2020
I know how to index a vector such that if x=[9,5,2,6,3] then, x(3) will equal 2 for example. But if I wanted to do it the opposite way, for example to find the minimum value in a vector and have matlab tell me what position in the vector that minimum value was, how would I do that?
In this example would want somthing like min(x) and then matlab would say 3 because the minimum value for x is in the 3rd position

Respuesta aceptada

madhan ravi
madhan ravi el 19 de Ag. de 2020
Second output of min() does that.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by