How to convert binary string to "two's complement" ?
조회 수: 28 (최근 30일)
이전 댓글 표시
Hi,
i've a little problem(i think). How could i convert binary string like (110010) for example, to "two's" complement? I searched in internet and in this forum, but have not found anything clear.
Is there any function to convert automatically?
I need to convert to two's complement all of this thirty one strings of 16 bits:
Orbital_Inclination =
1111110100111010
1111100111011000
1111110010011010
0000010011010000
1111111000110100
0001010110010111
0010010000111100
0001101101000000
0000000101111000
1101110010001100
0001100111111111
0001101011100111
0001011000110000
0000000010000100
0001101001111111
0000111000101110
1111011011100101
0000110001100100
1111011101001000
1111100010000111
1111010101101101
0000101000101110
0000101011101001
0001001010111001
0001100101000011
0000011001110100
0001100101110101
0000111010001111
0000110011100110
0001100011011111
0000010100111101
I hope that you may help me :)
Thanks!!
댓글 수: 5
채택된 답변
Walter Roberson
2012년 12월 6일
Create the number as 16 bit unsigned, uint16() specifically, and then typecast() to 'int16'
댓글 수: 0
추가 답변 (1개)
Alberto Fernandez
2012년 12월 9일
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!