How to other all the matrix based on other vector
Show older comments
How can I order a 2x2 matrix based on a vector For example:
B = [0 0 ; 1 4 ; 2 16 ; 3 19 ; 4 5 ; 5 39 ; 6 4]
C = [3 4 5 6 0 1 2]
the desired output is
D = [3 19; 4 5; 5 39; 6 4; 0 0; 1 4 ; 2 16]
I have been struggling trying to find the correct code line but i am only able to sort the one column and not the second column based on the first one
Accepted Answer
More Answers (1)
Jose Valles
on 11 Sep 2018
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!