I have a vector in Matlab B
of dimension nx1
that contains the integers from 1
to n
in a certain order, e.g. n=6 B=(2;4;5;1;6;3)
.
I have a vector A
of dimension mx1
with m>1
that contains the same integers in ascending order each one repeated an arbitrary number of times, e.g. m=13
A=(1;1;1;2;3;3;3;4;5;5;5;5;6)
.
I want to get C
of dimension mx1
in which the integers in A
are reordered following the order in B
. In the example, C=(2;4;5;5;5;5;1;1;1;6;3;3;3)