How to sort a two column vector
Mostrar comentarios más antiguos
I need to order this two column vector (attached) in such a way that the first column (x) is ordered ascending and the second column follows this order. In other words, it is very important to me that the values in the second column remain the same for each value of x.
Thanks in advance.
4 comentarios
dpb
el 2 de Jun. de 2020
s=sortrows(x);
dpb
el 2 de Jun. de 2020
Of course it worked... <VERY big grin> ...
Stephen23
el 11 de Jun. de 2020
Original question by Jórdan Venâncio Leite on 2nd June 2020 retrieved from Google Cache (uploaded data could not be retrieved):
"How to sort a two column vector"
I need to order this two column vector (attached) in such a way that the first column (x) is ordered ascending and the second column follows this order. In other words, it is very important to me that the values in the second column remain the same for each value of x.
Thanks in advance.
Rena Berman
el 12 de Oct. de 2020
(Answers Dev) Restored edit
Respuestas (2)
Categorías
Más información sobre Shifting and Sorting Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!