B = [1,0,1,0];s = num2str(B);s(s==' ') = [];A = zeros(1,4);for i = 1:4 A(i) = eval(s);endA
A =
1010 1010 1010 1010