I'm new to matlab and have a question on how to efficiently create a matrix from two or more vectors, where every combination of a single element from each vector is represented in a resulting matrix.
For example, say we have vectors:
x = [1 2 3 4]; y = [5 6 7 8];
I'd like to get the following result in matrix ans:
ans = [1 5; 1 6; 1 7; 1 8; 2 5; 2 6; 2 7; ... 4 7; 4 8]
The above example is for two-dimensions (two input vectors), however it would be ideal if the solution is for d-dimensions (d-number of input vectors). Thanks!