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!