Binary Bit Masking
조회 수: 40 (최근 30일)
이전 댓글 표시
What is the easiest way to bit mask a 16 bit binary value to decode different fields (2 bit, 4 bit, etc) with it? Thanks
댓글 수: 0
채택된 답변
추가 답변 (2개)
Walter Roberson
2011년 11월 16일
You could use bitand() and bitshift() too. Or just bitget().
Watch out for the bit numbering order that MATLAB uses.
댓글 수: 3
Fangjun Jiang
2018년 8월 17일
>> dec2bin(7,8)
ans =
'00000111'
>> bitget(7,1:8)
ans =
1 1 1 0 0 0 0 0
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Functions for Programming and Data Types에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!