필터 지우기
필터 지우기

adding zeros to a binary string

조회 수: 3 (최근 30일)
Chiara Adami
Chiara Adami 2013년 2월 14일
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
Jan
Jan 2013년 2월 14일
When you have problems with a command, here dec2bin, reading the documentation is a good idea:
help dec2bin
doc dec2bin
Chiara Adami
Chiara Adami 2013년 2월 15일
i've solved the problem on my own, reading the dec2bin dpcumentation more carefully, sorry for the stupid question :D thank you!! ^^

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 2월 14일
편집: Andrei Bobrov 2013년 2월 14일
binary = dec2bin(62, 8)
  댓글 수: 1
Chiara Adami
Chiara Adami 2013년 2월 15일
you are right! I've already solved the problem on my own, reading more carefully the documentation about dec2bin function :D thank u

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by