How to convert binary number to decimal integer?

조회 수: 11 (최근 30일)
Hoat Vu
Hoat Vu 2017년 9월 10일
답변: Jose Marques 2017년 9월 10일
I'm trying to convert from binary number to decimal integer. I have some clues that I have to use predefined function bin2dec() or dec2bin(). Example: 00101101110 --> -657 an example was given by my professor. However, I have no idea how he converted from this binary number to -657. I try to do by hand, converting 00101101110, I got 366. Using bin2dec(), I got 366.
  댓글 수: 1
David Goodmanson
David Goodmanson 2017년 9월 10일
Hi Hoat,
It appears that twos complement or ones complement is involved here although I could not quite get there. Somebody will know.

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

답변 (1개)

Jose Marques
Jose Marques 2017년 9월 10일

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by