I have a vector X with size (16 x 1), and another randomly generated small vector y of size (4 x 1), I want to fill the first two values of y in X(2) and X(3) and the other two values in X(15) and X(16), (It means, X(2) = y(1); X(3) = y(2); X(15) = y(3); X(16) = y(4)), then the next generated vector y will be placed in X(4), X(5), X(13) and X(14) and so on. How can I do that in Matlab using for example the loop for? For example:
X = zeros(16,1)
for i = 1 : 3
y = rand(4,1)
X(i+1) = y(1);
X(i+2) = y(2);
X(end-i+1) = y(4);
X(end-1) = y(3);
......
end
Now, I don't know how to place the values of the next generated vector y in next positions, which are X(4), X(5), X(end-3) and X(end-4), respectively.