Decimal to binary conversion

조회 수: 2 (최근 30일)
Shailee Yagnik
Shailee Yagnik 2019년 11월 25일
댓글: Shailee Yagnik 2019년 11월 25일
Is there a way where i can convert 3 to '011' instead of just '11'.
I need it to compare the reveived code error.
This is what i want to achieve.
Eg: u='111' % real code
v='011' %received code;
Hamming_distance= 1.

채택된 답변

Image Analyst
Image Analyst 2019년 11월 25일
Did you check the documentation for dec2bin()?
Try this:
d2b = dec2bin(3, 3); % returns '011'
  댓글 수: 1
Shailee Yagnik
Shailee Yagnik 2019년 11월 25일
Yes I did, but i guess i missed out on that! Thanks for the help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by