Function File: c = combnk (data, k)

Return all combinations of k elements in data.

Demonstration 1

The following code

 c = combnk (1:5, 2);
 disp ("All pairs of integers between 1 and 5:");
 disp (c);

Produces the following output

All pairs of integers between 1 and 5:
   1   2
   1   3
   1   4
   1   5
   2   3
   2   4
   2   5
   3   4
   3   5
   4   5

Package: statistics