I have a matrix of 8 columns and I want to select 2 column vectors at a time. And I want to select all possible binary combinations.

I used nchoosek to calculate the combination size as 28.

I tried using datasample, perms and randperm. But turns out nchoosek is the only function that selects all possible random combination. The issue I am facing is it does not let in a value of matrix as input. Is there any built in function in MATLAB that I am missing?

Similar questions and discussions