Decimal to binary conversion

2 visualizaciones (últimos 30 días)
Shailee Yagnik
Shailee Yagnik el 25 de Nov. de 2019
Comentada: Shailee Yagnik el 25 de Nov. de 2019
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.

Respuesta aceptada

Image Analyst
Image Analyst el 25 de Nov. de 2019
Did you check the documentation for dec2bin()?
Try this:
d2b = dec2bin(3, 3); % returns '011'
  1 comentario
Shailee Yagnik
Shailee Yagnik el 25 de Nov. de 2019
Yes I did, but i guess i missed out on that! Thanks for the help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by