How many combination will appear

조회 수: 5 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by