MATLAB: Array of 1 and 0 to decimal

arraybinaryMATLAB

How to convert array with 1's and 0's (array A) to decimal (array B)?
A = [1 0 0 1 0 0 1 1; 0 0 0 0 1 1 1 1; 1 0 1 0 1 0 1 0 ];
B = [147;15;170];

Best Answer

B = bin2dec(char(A + '0'))
B =
147
15
170