title: Generate all possible combinations of the elements of some vectors (Cartesian product)
body: <p>I would like to generate all the possible combinations of the elements of a given number of vectors.</p>
  
  <p>For example, for <code>[1 2]</code>, <code>[1 2]</code> and <code>[4 5]</code> I want to generate the elements:</p>
  
  <p><code>[1 1 4; 1 1 5; 1 2 4; 1 2 5; 2 1 4; 2 1 5; 2 2 4; 2 2 5]</code></p>
  
  <p>The problem is that I don't know the number of vectors for which I need to calculate the combinations. There might be 3 as in this case, or there may be 10, and I need a <em>generalization</em>. Can you please help me to this in MATLAB? Is there already a predefined function that can do this task?</p>