Azzera filtri
Azzera filtri

change binary string to decimal

1 visualizzazione (ultimi 30 giorni)
Kugen Raj
Kugen Raj il 6 Apr 2012
GGG =
0 1 0 0 0 1 0 0 0 0
0 1 0 0 0 1 0 0 0 0
1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 1 0 1 0 0 0 1
0 0 1 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 1 0 1 0 0 0 0 0 1
1 0 0 1 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 1
I hve this binary string. I need to convert this to decimal. How can I do this?

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 6 Apr 2012
try use this is code:
GGG =[ 0 1 0 0 0 1 0 0 0 0
0 1 0 0 0 1 0 0 0 0
1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 1 0 1 0 0 0 1
0 0 1 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 1 0 1 0 0 0 0 0 1
1 0 0 1 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 1]
out = GGG*2.^(size(GGG,2)-1:-1:0).';

Più risposte (0)

Categorie

Scopri di più su Numeric Types in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by