How do I sort a column based on the values in another column in MATLAB?
Column A
shows position data (it is neither ascending or descending in order) Column B
contains another column of position data. Finally column C
contains numerical values. Is it possible to link the first position value in B
with its numerical value in the first cell of C
? Then after this I want to sort B
such that it is in the same order as column A
with the C
values following their B
counterparts?The length of my columns would be 1558 values.
Before case;
A B C
1 4 10
4 1 20
3 5 30
5 2 40
2 3 50
After Case;
A B C
1 1 20
4 4 10
3 3 50
5 5 30
2 2 40
Basically A
and B
became the same and Column C
followed B
.