MATLAB: How to store each and every bit of de2bi(k(r)) to the variable

decimal to binary conversionstoring binary value to the string

if true
% code
while r<((M*N)+1)
for i=1:M
for j=1:N
k(r)=imag1(i,j);
l(r)=k(r);
b(r)=de2bi(k(r));
r=r+1;
end
end
The de2bi(k(r)) is '10010101' but whether it is possible to store this 8 bit value as k(1)=1 k(2)=0 k(3)=0 … … k(8)=1

Best Answer

b(r, :)=de2bi(k(r), 8);
Related Question