フィルターのクリア

how to generate 2^16 different combinations of a vector containing 0 and 1 only?

1 回表示 (過去 30 日間)
Mnr
Mnr 2015 年 12 月 9 日
コメント済み: Mnr 2015 年 12 月 9 日
Hello all,
I would like to generate 2^16 different combinations of 16 bits containing 0s and 1s. I have tried different ways like using nchoosek,... but I have the out of memory error. Could somebody please propose a more efficient way? Thank you!
  1 件のコメント
James Tursa
James Tursa 2015 年 12 月 9 日
Please explain the problem you are working and why you think you need this matrix in memory all at once.

サインインしてコメントする。

採用された回答

the cyclist
the cyclist 2015 年 12 月 9 日
As a character array:
dec2bin(0:2^15-1)
As a numeric matrix of 1s and 0s:
dec2bin(0:2^15-1) - '0'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by