how to define 4 bit Enumerated value and a nibble(4 bits) in Matlab
6 次查看(过去 30 天)
显示 更早的评论
Hello,
how to define 4 bit Enumerated value and a nibble(4 bits) in Matlab
0 个评论
采纳的回答
Thorsten
2016-1-20
Use a number between 0 and 15.
n = 8;
To convert to binary
nbin = dec2bin(n) - '0';
dec2bin return a string, the -'0' converts this string to an array of 0's and 1's.
5 个评论
Walter Roberson
2016-2-1
sBytes = uint8(s);
send sBytes. Reconstruct on the other side with
s = char(sBytes);
Do not bother converting to bits!!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!