Hi!
I am looking to create a matrix that contains all possible combinations of elements in an array of size n, but to a smaller number size of matrix
For example, if x = [1,2,3,4,5], I might want to produce a [4x(5^4)] matrix that contains 625 combinations of 4 numbers from x, or a [(3×5^3)] matrix that contains 125 combinations of 3 numbers.
Is there a MATLAB function that would assist with this, as opposed to making many for loops?
Any help would be much appreciated!
Best Answer