adding zeros to a binary string
Ältere Kommentare anzeigen
Hello! This is my problem : i need to convert uint8 variables in binary ones but with 8 bits. Now, if the binary number does not have 8 bit, how can i add zero on the left, without changing the number? Does exist a MAtlab Function for this?
example
uint8 = 62
binary = dec2bin(62)
binary = 111110 -> 6 bit
instead i want 8 bit, so something like 00111110
2 Kommentare
Jan
am 14 Feb. 2013
When you have problems with a command, here dec2bin, reading the documentation is a good idea:
help dec2bin
doc dec2bin
Chiara Adami
am 15 Feb. 2013
Antworten (1)
Walter Roberson
am 14 Feb. 2013
Bearbeitet: Andrei Bobrov
am 14 Feb. 2013
binary = dec2bin(62, 8)
1 Kommentar
Chiara Adami
am 15 Feb. 2013
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!