how to convert hex array to decimal array ?
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hello i want to convert hex number to dec for exmaple :
a=hex2dec('d2')
now i want an array of hex numbers for exmaple :[ d1 d2 d4 cf ] how can i convert this array ?
0 Commenti
Risposta accettata
Stephen23
il 3 Mag 2018
Modificato: Stephen23
il 3 Mag 2018
One char vector, fixed length hexadecimal, no spaces:
>> sscanf('d1d2d4cf','%2x')
ans =
209
210
212
207
One char vector, any length, space characters:
>> sscanf('d1 d2 d4 cf','%x')
ans =
209
210
212
207
From one cell array, any length char vectors:
>> C = {'1','d2','d4','cf'};
>> sscanf(sprintf('%s\v',C{:}),'%x\v')
ans =
1
210
212
207
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Digital Input and Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!