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일
You can ‘cheat’ and convert ‘str’ to numeric by subtracting the character '0' from it:
str = dec2bin(j,8) - '0';

카테고리

도움말 센터File Exchange에서 Data 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