Borrar filtros
Borrar filtros

How to find indices of ranking of element in matrix

8 visualizaciones (últimos 30 días)
Pradya Panyainkaew
Pradya Panyainkaew el 8 de Feb. de 2018
Editada: Tomás Nunes el 19 de Mzo. de 2018
if i have A=[0 32 103 59 543]; How can I find a ranking indices of each element to get a result like this
Result=[5 4 2 3 1]
Thanks in advance

Respuesta aceptada

Birdman
Birdman el 8 de Feb. de 2018
[~,idx]=ismember(A,sort(A,'descend'))
  2 comentarios
Pradya Panyainkaew
Pradya Panyainkaew el 8 de Feb. de 2018
Thank you so much Birdman.
Tomás Nunes
Tomás Nunes el 19 de Mzo. de 2018
Editada: Tomás Nunes el 19 de Mzo. de 2018
how would it look if we had a matrix instead? for example, a 3x3 matrix, in which I want to rank by row. A = [4 3 6;7 8 3; 2 4 1] to look like this idx = [2 3 1; 2 1 3; 2 1 3]

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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