How many combination will appear

8 visualizzazioni (ultimi 30 giorni)
dhmhtrhs
dhmhtrhs il 7 Gen 2017
Modificato: Image Analyst il 8 Gen 2017
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)

Risposte (1)

Roger Stafford
Roger Stafford il 7 Gen 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 Commenti
dhmhtrhs
dhmhtrhs il 8 Gen 2017
i don't know good english, i want write a example the who are executable for i see doing
Roger Stafford
Roger Stafford il 8 Gen 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

Accedi per commentare.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by