Statistics Toolbox    
combnk

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 C with k columns and n! / k!(n-k)! rows, where each row contains k of the elements in the vector v.

It is not practical to use this function if v has more than about 15 elements.

Example

Combinations of characters from a string.

Combinations of elements from a numeric vector.


  cmdscale cophenet