MATLAB: Row Wise concatenation

concatenationinterleave

I have 2 matrices
a= [ 1 2 3
4 5 6
7 8 9 ]
B= [9 8 7
6 5 4
3 2 1]
Output should be:
AB= [1 2 3
9 8 7
4 5 6
6 5 4
7 8 9
3 2 1]

Best Answer

Try this:
AB = reshape([a, B]', 3, [])' % Interleave arrays.