how to find possible combinations

2 vues (au cours des 30 derniers jours)
Postit123
Postit123 le 6 Nov 2020
Commenté : Postit123 le 6 Nov 2020
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 commentaire
KSSV
KSSV le 6 Nov 2020
You mean you want 4X10X8 matrices of all combinations?

Connectez-vous pour commenter.

Réponse acceptée

Bruno Luong
Bruno Luong le 6 Nov 2020
Modifié(e) : Bruno Luong le 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]);
  1 commentaire
Postit123
Postit123 le 6 Nov 2020
Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by