Given I have two arrays, say:
a = [0.8, 0.2,0.1,20,1.5,5.8,12]
b = [2,1,3,1,2,2,3]
Now I want to order the entries in a according to the numbers in b, in that I would want to have all 1's first in the respective order, then the 2s, then the 3.., for these example arrays I would want to get the following:
c = [0.2,20,0.8,1.5,5.8,0.1,12]
How can I do that efficiently in MATLAB? Tks