Finding 3 largest values in a matrix

Consider I have a large matrix (say 24*30), is there a way to find the three largest values?
I know that we can find the biggest value using this command:
max(A, [], 'all')
But is there another way around this?

 Respuesta aceptada

Star Strider
Star Strider el 29 de Mzo. de 2021

2 votos

If you have R2017b or later, the maxk function will likely be useful.

4 comentarios

Youssef Chehade
Youssef Chehade el 29 de Mzo. de 2021
I tried it, but it is giving me the biggest element in each column. So giving me 30 values if i set k to 1
maxk(A(:),3)
Youssef Chehade
Youssef Chehade el 29 de Mzo. de 2021
Oh wow, thank you so much
Star Strider
Star Strider el 29 de Mzo. de 2021
As always, my pleasure!
Matt J — Thank you for the amplification.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Mzo. de 2021

Comentada:

el 29 de Mzo. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by