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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 29일
편집: Azzi Abdelmalek 2012년 11월 29일

1 개 추천

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

추가 답변 (1개)

John Petersen
John Petersen 2012년 11월 29일

0 개 추천

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

kash
kash 2012년 11월 29일
Yes i know it ,in MSB i neeed to add zero to make it a 5 bit

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

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

태그

질문:

2012년 11월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by