Generate Only a Specific Number of Combinations
古いコメントを表示
I would like to loop through the combinations of 30 take 20 with no repetition and order does not matter. I would only like to compute the first 100 or so combinations as there are over 30,000,000 total combinations. Is there a MatLab function that will allow me to do this? Functions like nchoosek will generate all possible combinations and take a very long time.
採用された回答
その他の回答 (1 件)
Matt J
2012 年 11 月 27 日
This will generate 120 combinations
A=nchoosek(10,1:3);
N=size(A,1);
Result=[A,repmat(11:27,N,1)];
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!