For ex;I have an array A=[1:4] and B=[12:19:2:20].If I sort B in descending order B=[20 19 12 2].I want the corresponding positions in A to be swapped as well…ie A=[4 2 1 3].How do I achieve that?

# MATLAB: Combined sorting

paired sorting

###### Related Question

- Sorting according to another vector
- How to sort the rows of an array according to another vector
- Matrix Sortrows by one of it Values
- How to manipulate arrays more efficiently
- How to track location of number in array after sorting
- Ranking (ordering) values with repeats
- Generation of permuted matrix
- Row indices of an array which is a subset of another array

## Best Answer