Can i multiply a binary one with a decimal number?

I was trying to convert a decimal number into binary vector. I was assuming i could use those vectors in the equation next and store the values but it gives me weird answers? How can i tackle this problem?

回答 (1 件)

Star Strider
Star Strider 2017 年 4 月 27 日

0 投票

You can ‘cheat’ and convert ‘str’ to numeric by subtracting the character '0' from it:
str = dec2bin(j,8) - '0';

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

質問済み:

2017 年 4 月 27 日

回答済み:

2017 年 4 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by