convert from hexa to binary??
66 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have 32 bits in hexa I want to convert it to binary without lossing accuracy? I used hex2dec and then dec2bin but the output is n't as expected. ex:
v=('981ba682 4c1bfb1a b4854720 29b71d80')
v(v == ' ') = []
v=hex2dec(v)
v=dec2bin(v)
this is the expected o/p : 10011000 00011011 10100110 10000010 01001100 00011011 11111011 00011010
10110100 10000101 01000111 00100000 00101001 10110111 00011101 10000000
but I got:
10011000000110111010011010000010010011000001101111111000000000000000000000000000000000000000000000000000000000000000000000000000
0 Commenti
Risposte (1)
Limabean
il 8 Dic 2022
Slightly different approach:
newStr = regexprep('981ba682 4c1bfb1a b4854720 29b71d80','([A-F0-9])','${dec2bin(hex2dec($1))}','ignorecase')
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Type Conversion 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!