How many combination will appear

3 ビュー (過去 30 日間)
dhmhtrhs
dhmhtrhs 2017 年 1 月 7 日
編集済み: Image Analyst 2017 年 1 月 8 日
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)

回答 (1 件)

Roger Stafford
Roger Stafford 2017 年 1 月 7 日
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 件のコメント
dhmhtrhs
dhmhtrhs 2017 年 1 月 8 日
i don't know good english, i want write a example the who are executable for i see doing
Roger Stafford
Roger Stafford 2017 年 1 月 8 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by