title: Concatenating all combinations of matrix rows
body: <p>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.</p>
  
  <p>I tried ndgrid, but this creates ALL possible combinations. I need the input rows to stay together to create the output.</p>
  
  <p>Here is an example:</p>
  
  <p>I got:</p>
  
  <pre><code>  a= [1 2 3
        4 5 6];
  
    b= [7 8
        9 10];
  </code></pre>
  
  <p>I need:</p>
  
  <pre><code>needed = [1 2 3 7 8
            1 2 3 9 10
            4 5 6 7 8
            4 5 6 9 10];
  </code></pre>
  
  <p>I would prefer to do this without loops if possible</p>