MATLAB: Inserting into certain locations in array

inserting arraysMATLABmatrix arraymatrix manipulation

A=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
B = [ 10 20 30]
C= 3 % is the position where I want to insert B in A
I = 2 % is the number of times or multiple
output must be:
F = [ 1 2 3 10 20 30 4 5 6 10 20 30 7 8 9 10 11 12 13 14 15]
if C= 2 and I = 4
then, F = [ 1 2 10 20 30 3 4 10 20 30 5 6 10 20 30 7 8 10 20 30 9 10 11 12 13 14 15]

Best Answer

F = A;
for i = 1:I
F = [F(1:C*i+length(B)*(i-1)),B,F(C*i+length(B)*(i-1)+1:end)];
end