How i can convert from hex numbers to charter ?

1 次查看(过去 30 天)
I have hexa numbers array like this
'12'
'A6'
'36'
'36'
'F6'
'04'
'EA'
'F6'
'4E'
'36'
'26'
I want to convert to charecter like this
'Hello world'
can anyone help me to solve this problem ?
  1 个评论
DGM
DGM 2022-1-21
C0 = 'Hello world';
H = ['12'; 'A6'; '36'; '36'; 'F6'; '04'; 'EA'; 'F6'; '4E'; '36'; '26'];
C = char(hex2dec(H)).'
C = '¦66öêöN6&'
C-C0
ans = 1×11
-54 65 -54 -54 135 -28 115 135 -36 -54 -62
C = char(hex2dec(fliplr(H))).'
C = '!jcco@®oäcb'
C-C0
ans = 1×11
-39 5 -9 -9 0 32 55 0 114 -9 -2
It's not immediately apparent how these are encoded, or if they're encoded correctly.

请先登录,再进行评论。

回答(1 个)

Voss
Voss 2022-1-21
hexStr = ['12';'A6';'36';'36';'F6';'04';'EA';'F6';'4E';'36';'26'];
char(bin2dec(fliplr(dec2bin(hex2dec(hexStr),8)))).'
ans = 'Hello World'

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by