I want the following help in linear fashion:
A new vector Q(n) is needed, such that, if y(i) is 1, then the ith element in Q(n) should be 0. And in rest of the places, the P(n) should get repeated.
Q=[0 1 2 0 1 2].
Q=[1 2 0 1 2 3].
Basically, beside the zeros on ith position, the vector P should repeat itself in non-zero positions of Q
Can you please help me formulating this problem?