How to create all possible combinations in MATLAB
Afficher commentaires plus anciens
Hi everyone,
I have a vector of 8 columns, x=[a b c d e f g h];
where all letters are integer vectors as follows
a=1:1:20;b=1:1:6; c=1:1:15; d=1:1:26; e=1:1:56; f=1:1:56; g=1:1:11; and h=1:1:31 ;
I would like to make a matrix which includes all possible combinations of these letters and have this size
columns = 6
rows= 20*6*15*26*56*56*11*31;
all possible combinations are needed in my situation.
for example; the first combination should look like this : [1 1 1 1 1 1 1 1]
and the last combination should look like this : [20 6 15 26 56 56 11 31]
and the final matrix should look like this ComMat= [1 1 1 1 1 1 1 1; ...... ; 20 6 15 26 56 56 11 31];
I appreciate your support!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!