Shifting operations and bitwise logical operations with binary numbers
이전 댓글 표시
Hi friends, Actually i need to do right shifting of a binary numbers.
For Example:
a=200
b=dec2bin(200)
c=str2num(b)
d=bitshift(c,3)
Binary of 200 is 11001000. If i right shift it by 3 i should get 00011001 but d is giving 88008000. Even "bitsll" command is not giving desired results.
In addition to this i also need to work with bitwise logical operators.I tried in different ways using( "and" , "&" , "&&") but nothing is working.
Please suggest me the right way of working with above mentioned operations with binary numbers.
Thanks
채택된 답변
추가 답변 (3개)
a=200
b=bitshift(a,-3)
c=dec2bin(b,8)
Iman Ansari
2013년 4월 10일
편집: Iman Ansari
2013년 4월 10일
a=200
b=dec2bin(200)
c=shift(b,3)
카테고리
도움말 센터 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!