max value

4 visualizaciones (últimos 30 días)
osman yurdakul
osman yurdakul el 22 de Mzo. de 2011
et's suppose i have an array like:
x = [1 2 35 33]
and i'd like to find which element is the max element of this array...
i mean max(x) = 35 but i do not know the row of the max value but in x it's the third element. but if i do not know this how can i find?
thanks for your helps

Respuesta aceptada

Matt Fig
Matt Fig el 22 de Mzo. de 2011
Better to use the capabilities of MAX, than to use FIND and a comparison.
[mx,I] = max(x); % mx is the maximum value, I is the location.

Más respuestas (1)

Paulo Silva
Paulo Silva el 22 de Mzo. de 2011
find(x==max(x))

Categorías

Más información sobre Elementary Math 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