I have n
states like 10, 15, 18, ...
and I want to generate all possible combinations of my states in an array with length of m
.
For example, if m=5
and n=2
(states={10,15}
), I want to generate all possible combinations like this example:
comb = { 10 10 10 10 15
10 10 10 15 10
10 10 10 15 15
...
15 15 15 15 10 }
Each row should consist of one possible combination of 10, 15
. How to generate this array in MATLAB?