convert decimal to hex with 3 digit
조회 수: 12 (최근 30일)
이전 댓글 표시
I just realized that converting -30 to hexadecial by dec2hex(-30) is different from its converting back by hex2dec('E2'). Any suggestion donig right?
dec2hex(-30)
hex2dec('E2')
Also if I want to specify the decimal in signed 12 bit (e.g., 3 hex digital), what am I supposed to do?
댓글 수: 0
채택된 답변
Chunru
2023년 12월 20일
dec2hex(-30) % this converts to hex in 2's complement
hex2dec('E2') % this treats the hex as unsigned by default
hex2dec('0xE2s8') % s8 to indicate the hex is a signed 8 bit nmber; 0x prefix is also needed
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!