Statistics Toolbox
  Go to function:
    Search    Help Desk 
combnk    Examples

Enumeration of all combinations of n objects k at a time.

Syntax

Description

C = combnk(v,k) returns all combinations of the n elements in v taken k at a time.

C = combnk(v,k) produces a matrix, with k columns. Each row of C has k of the elements in the vector v. C has n!/k!(n-k)! rows.

It is not feasible to use this function if v has more than about 10 elements.

Example

Combinations of characters from a string.

Combinations of elements from a numeric vector.



[ Previous | Help Desk | Next ]