convert 16bit char to 4 byte hex values
이전 댓글 표시
I have an length X 16 variable of type char. i'd like to convert it to length x 4 nibble hex values
example input: char(3x16)
1000100010001000
0000000000000010
111111111111111111
output wanted 8888
0002
FFFF
답변 (1개)
c=char(["1000100010001000";
"0000000000000010";
"1111111111111111"])
d=dec2hex(bin2dec(c))
댓글 수: 4
Darin Liberda
2023년 6월 27일
Fangjun Jiang
2023년 6월 27일
I thought there should be a bin2hex() function but didn't find it. Maybe someone else can suggest a direct conversion method?
Fangjun Jiang
2023년 6월 27일
If your original data is not constrained to be char array, maybe take a look at this document
Nathan Hardenberg
2023년 7월 11일
There is a custom bin2hex()-function on File Exchange
카테고리
도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!