Borrar filtros
Borrar filtros

change binary string to decimal

1 visualización (últimos 30 días)
Kugen Raj
Kugen Raj el 6 de Abr. de 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?

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 6 de Abr. de 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).';

Más respuestas (0)

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by