I came across this question from my book. this is the question:
write a function interleave which takes two vectors of the same length and returns a vector which is the result of interleaving the elements of two input vectors. for example,
interleave([1 2 3],[10 11 12]) = [1 10 2 11 3 12]
interleave([1 2 3 4], [-1 -2 -3 -4]) = [1 -1 2 -2 3 -3 4 -4]
in the book it says it's worth 9 marks. this is what i've done:
function res = interleave(A,B)
trans = [A' B'];
reshape_col = length(A)+length(B);
res = reshape(trans', 1, reshape_col)
what i've done gets me the right answer but it seems too less work for 9 marks. i'm not too sure if there is another way of getting to answer. any help will be appreciated. thanks