Combinations and Matrices?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ali Almakhmari
am 21 Mär. 2023
Beantwortet: the cyclist
am 21 Mär. 2023
Can someone help me figure out an efficient way to create a matrix that is N by 20, where N is the number of all possible unique combinations. Each row of the matrix will have 20 elements in them, the elements can be either 0 or 1. I want to create this gigantic matrix that contains all possibilities of rows.
0 Kommentare
Akzeptierte Antwort
the cyclist
am 21 Mär. 2023
There just happens to be a very obfuscated way to do this:
M = dec2bin(0:2^20-1) - '0';
size(M)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!