nchoosek
Combinatorial function for selecting from a set of items.
Syntax
C=nchoosek(n,k)
C=nchoosek(v,k)
Inputs
- n
- The number of items from which to choose.
- v
- The list of items from which to choose.
- k
- The number of items to choose.
Outputs
- C
- The number of combinations or the list of combinations stored by row.
Examples
Number of combinations example:
C = nchoosek(9,4)
C = 126
C = nchoosek([10,20,30,40,50],3)
C = [Matrix] 10 x 3
10 20 30
10 20 40
10 20 50
10 30 40
10 30 50
10 40 50
20 30 40
20 30 50
20 40 50
30 40 50