MATLAB: How to sort one side of a matrix

MATLABmatrixsortvectors

Here is my issue, I have to organize a column vector in descending order, however I need to assign another vector to it without sorting that one.
i.e.
  • 92.5, 3005
  • 100, 6998
  • 98.3, 5412
Needs to be written as
  • 100, 6998
  • 98.3, 5412
  • 92.5, 3005
The two colums are separate vectors, but I saved them to one matrix by using x=[scores, IDnumbers]
Once I get them organized properly, I need to display them both using one disp() command.
How do I organize the right side while keeping the same IDs with their respective scores?

Best Answer

doc sortrows