All combinations of binary matrix

I'm trying to use matlab to generate all the possible codes for a generator matrix. However, for arbitrary size, putting in each code becomes cumbersome:
G = [1 0 0 0 0 1 1; 0 1 0 0 1 0 1; 0 0 1 0 1 1 0; 0 0 0 1 1 1 1]
[0 0 0 0] * G
[0 0 0 1] * G
...
Is there a way to do this programmatically? I suspect some sort of for loop, but there may be a builtin for this that I'm unaware of.

回答 (1 件)

Jos (10584)
Jos (10584) 2017 年 11 月 30 日

0 投票

G = [1 0 0 0 0 1 1; 0 1 0 0 1 0 1; 0 0 1 0 1 1 0; 0 0 0 1 1 1 1]
C = permn([0 1],size(G,1))
R = C * G
PERMN can be downloaded from the File Exchange

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

質問済み:

2017 年 11 月 30 日

回答済み:

2017 年 11 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by