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?

采纳的回答

James Tursa
James Tursa 2019-6-20
E.g.,
bstream = reshape(b',1,[]);
If you want characters, then
bstream = char(reshape(b',1,[]) + '0');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by