How to create all possible combinations in MATLAB
이전 댓글 표시
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!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!