Decimal to Binary Conversion
1 回表示 (過去 30 日間)
古いコメントを表示
As,
d = (1:5);
b = de2bi(d,4,'left-msb'); will give us...
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
But, I need the output to be like this:
b = 00010010001101000101 i.e. in the form of bit-stream.
How can I achieve this?
0 件のコメント
採用された回答
James Tursa
2019 年 6 月 20 日
E.g.,
bstream = reshape(b',1,[]);
If you want characters, then
bstream = char(reshape(b',1,[]) + '0');
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!