MATLAB Answers

Sort indices to groups with all pairs sampled

1 view (last 30 days)
Leore Heim
Leore Heim on 24 Nov 2019
Answered: Rik on 24 Nov 2019
Hi,
I would to sort a vector of indices
[i = 1 : n]
to groups of size m such that all index pairs appear in at least one group.
For example:
i = 1 : 5;
m = 3;
g = [ 1 2 3
1 4 5
2 4 5
3 4 5];
The main difficulty for me is to keep the number of groups to a minimum.
Please note that mod(n, m) ~= 0.
Thank you in advance.

  0 Comments

Sign in to comment.

Answers (1)

Rik
Rik on 24 Nov 2019
It looks like nchoosek should do the trick for you.

  0 Comments

Sign in to comment.

Sign in to answer this question.