How to convert binary number to decimal integer?

11 Ansichten (letzte 30 Tage)
Hoat Vu
Hoat Vu am 10 Sep. 2017
Beantwortet: Jose Marques am 10 Sep. 2017
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 Kommentar
David Goodmanson
David Goodmanson am 10 Sep. 2017
Hi Hoat,
It appears that twos complement or ones complement is involved here although I could not quite get there. Somebody will know.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jose Marques
Jose Marques am 10 Sep. 2017

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by