I have vectors a, band c; vectors aand bcontain integers, and the vector chas binary values as elements: ( 0, 1).
The vector ahas a length n, and the vector bhas a length k. The vector chas a length of n + k.
I want to concatenate vectors aand bbased on a vector c.
For example. If c=[1 0 0 1 0 . . . . ], then I want to create a vectorres=[a(1) b(1) b(2) a(2) b(3) . . . ].
Is there a way to do this without a loop for?
source
share