How can I generate a set containing all possible combinations?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Let say I want to have a 2x2 matrix and the entries are chosen from numbers 1-8 (without repetition).
How can I generate a set that contains all the possible matrices? Thanks a lot!
0 Kommentare
Antworten (2)
Bruno Luong
am 28 Mär. 2019
Bearbeitet: Bruno Luong
am 28 Mär. 2019
A = nchoosek(1:8,4);
A = num2cell(reshape(A',2,2,[]),[1 2]);
A = A(:);
% display
A{:}
Produces 70 2x2 matrices
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!