How many combination will appear
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
A=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49];
B = nchoosek(A, 7)
0 commentaires
Réponses (1)
Roger Stafford
le 7 Jan 2017
I hope you have a lot of memory available to matlab! B will be of size 85900584 by 7. That is, there will be 49!/7!/42! combinations.
3 commentaires
Roger Stafford
le 8 Jan 2017
I’m not sure I completely understand what you are saying, Dhmhtrhs. I ran the above code on my computer’s version of Matlab, and got the following random result. I chose N = 10, so C has ten rows with each one containing a combination of seven random numbers chosen from among the numbers from one to forty-nine. You are probably interested in more than ten random samples, but probably far less than 49!/7!/42! = 85,900,584.
disp(C)
1 10 14 16 25 32 46
19 21 25 28 30 40 47
7 10 12 25 29 31 35
1 10 12 26 32 38 39
22 24 33 34 35 37 47
10 24 25 28 39 41 43
4 6 23 25 33 37 48
7 11 13 16 19 26 28
7 17 20 26 30 35 37
6 8 17 23 28 34 36
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!