Combinations and Matrices?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
the cyclist
2023 年 3 月 21 日
There just happens to be a very obfuscated way to do this:
M = dec2bin(0:2^20-1) - '0';
size(M)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!