Matlab - Generate all possible combinations of the elements of some vectors
===

I would like to generate all the possible combinations of the elements of a given number of vectors.

For example for `[1 2]`, `[1 2]` and `[4 5]` I want to generate the elements:
<br>`[1 1 4; 1 1 5; 1 2 4; 1 2 5; 2 1 4; 2 1 5; 2 2 4; 2 2 5]` <br>
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 generalization. Can you please help me to this in Matlab? Or if you know an already predefined function which can do this task.