Converting 4 bits to 5 bits

I have values
a=10 8 15
converted to decimal using
a1 = dec2bin(mod(2^5+a,2^5))
even after performing ,i get only 4 bit values ,where as i need 5 bit value
please asssit

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 29 de Nov. de 2012
Editada: Azzi Abdelmalek el 29 de Nov. de 2012

1 voto

use
a1 = dec2bin(mod(2^5+a,2^5),5)

Más respuestas (1)

John Petersen
John Petersen el 29 de Nov. de 2012

0 votos

you only need 4 bits for values under 16. The fifth bit in your case is 0. Try a=20. and you will see the fifth bit.

1 comentario

kash
kash el 29 de Nov. de 2012
Yes i know it ,in MSB i neeed to add zero to make it a 5 bit

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 29 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by