I am trying to write a code that will do thr following:
R=[a b c d]'; ranks=[1 2 3 1];
a has rank 1; b has rank 2;
c has rank 3; and d has rank 1;
I want to re-arrange R st that those elements whose ranks 1 are listed first followed by those who ranks 2 and so on.
So the output be:
R=[a d b c]'
This is a special case in other cases the vectors R and ranks will be very huge so I am trying to find a code that is efficient