MATLAB: Change binary string to decimal

MATLAB

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?

Best Answer

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).';
Related Question