I need to create an algorithm in matlab which returns any combination of n subset from the k set. For example I have a set {1,2,3,4,5} and I need any combination of 3 numbers included in this set. So this function should returns: [[1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 3, 4], […]

Categories

## Printing n choose k combinations in matlab

- Post author By Full Stack
- Post date December 1, 2019
- No Comments on Printing n choose k combinations in matlab

- Tags 1, 2, 3, 4, 5, 5]] I have tried to write it by myself, 5} and I need any combination of 3 numbers included in this set. So this function should returns: [[1, but it creates endless loop. for i=1:n if(firstTime) lastComb=min //123 firstTime=false else for d=k:-1:1, but unsuccessfully and I give up. It partially works, end) < n-k+d && lastComb(:, end=''), I need to create an algorithm in matlab which returns any combination of n subset from the k set. For example I have a set {1