MATLAB: How to find possible combinations

combination

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.

Best Answer

% 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]);