i use matlab and need to combine two 2-dimensional matrices, so that the resulting rows are combinations of the rows from the input matrices concatenated together.
I tried ndgrid, but this creates ALL possible combinations. I need the input rows to stay together to create the output.
Here is an example:
I got:
a= [1 2 3
4 5 6];
b= [7 8
9 10];
I need:
needed = [1 2 3 7 8
1 2 3 9 10
4 5 6 7 8
4 5 6 9 10];
I would prefer to do this without loops if possible