Converting 4 bits to 5 bits

2 ビュー (過去 30 日間)
kash
kash 2012 年 11 月 29 日
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 日
use
a1 = dec2bin(mod(2^5+a,2^5),5)

その他の回答 (1 件)

John Petersen
John Petersen 2012 年 11 月 29 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by