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 dataA=rand(32,10);[m,n]=size(A);I=nchoosek(1:m,4).';% Each slice B(:,:,k) is a 4x10 (without-replacement) combinationB=permute(reshape(A(I,:),4,[],n),[1 3 2]); Related SolutionsMATLAB: Replicate values of a vector Hi,try repmat:repmat(A,4,1)Or for the other direction:repmat(A,1,4)In the case you want it repeated like this: [1 1 1 1 2 2 2 2 ....] you can use repmat and reshape:reshape(repmat(A,4,1),[],1) MATLAB: Can someone do this calculation without for loops k = bsxfun(@times, a , reshape(b.^2,1,1,[])) alt_k = bsxfun(@times, a , permute(b.^2,[3,1,2])) Related QuestionCombinations with constraintRepeat every element in matrix‘combnk’ enumeration of combinationsRearrangement rows of matricesCombinations of matrix rowsReshape 3d to 2d array
Best Answer