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!