Effacer les filtres
Effacer les filtres

how transform binary>255 to decimal??

1 vue (au cours des 30 derniers jours)
amira hl
amira hl le 13 Juin 2015
Modifié(e) : amira hl le 13 Juin 2015
hi
in binary
M =
0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0
I typed
M1=bi2de(M)
M1 =
255
Or M1=306, how can I get the real number?

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Juin 2015
bi2de is not documented as having any such limitation, and there is an example in the documentation showing a result over 500. But if you were storing the result in a uint8 location in an array then the result would "saturate" at 255 because uint8 cannot store numbers larger than that.
I do not have bi2de() to test with.
A different way of doing things is
bin2dec(char(M+'0'))
which would return the full 19584 for M

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by