I have vectors a,b and c; vectors a and b contain integer numbers while vector c has binary values as elements: (0,1).
Vector a has length n and vector b has length k. Vector c has length n+k.
I want to concatenate vectors a and b based on vector c.
For example. If c=[1 0 0 1 0 . . . . ] then I want to create vector res=[a(1) b(1) b(2) a(2) b(3) . . . ].
Is there any way to do so without a for loop?