how to find possible combinations

Hello
There's a 32X10 matrix dataset and I want to need all possible 4X10 data combinations.
Plus the data of each row remain same through the combination.
Do you have any idea for this?
Thanks you.

1 Comment

You mean you want 4X10X8 matrices of all combinations?

Sign in to comment.

 Accepted Answer

Bruno Luong
Bruno Luong on 6 Nov 2020
Edited: Bruno Luong on 6 Nov 2020
% Test data
A=rand(32,10);
[m,n]=size(A);
I=nchoosek(1:m,4).';
% Each slice B(:,:,k) is a 4x10 (without-replacement) combination
B=permute(reshape(A(I,:),4,[],n),[1 3 2]);

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!