MATLAB: Need to combine every other column of two row vectors of different sizes in MATLAB

combining vectos

I have 2 row vectors of different sizes, say:
A = [1 3 5 7 9 11 13 15 17]
B = [2 4 6 8 10 12].
I need to combine vectos A & B to make a new C vector that is the same length of the shorter matrix B such that,
C = [ 1 2 3 4 5 6].
Any help would be very much appreciated, I can't seem to figure out the proper indexing needed to accomplish this in a for loop.

Best Answer

One approach:
A = [1 3 5 7 9 11 13 15 17];
B = [2 4 6 8 10 12];
C(1:2:numel(A)*2) = A;
C(2:2:numel(B)*2) = B;
C = C(1:min(numel(A),numel(B)))
producing:
C =
1 2 3 4 5 6