How i can convert from hex numbers to charter ?

1 view (last 30 days)
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 Comment
DGM
DGM on 21 Jan 2022
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.

Sign in to comment.

Answers (1)

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

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!