sorting vector by value and position
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tomas
el 5 de Nov. de 2022
Comentada: Tomas
el 5 de Nov. de 2022
Hello, i need to sort this vector by value and also keep the position [109 97 116 108 97 98] to [5 1 6 4 2 3].
Any ideas how to do it?
0 comentarios
Respuesta aceptada
Torsten
el 5 de Nov. de 2022
A = [109 97 116 108 97 98];
[~,p] = sort(A,'ascend');
r = 1:length(A);
r(p) = r
Más respuestas (0)
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices 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!