% binm=dec2binm(dec,m)
% Converts the decimal number dec into a matrix with m binary values
% expressing the binary form. The order is LSB to MSB. The vector
% produced has at least m entries.
%
% George Ginis, June 2001
function binm=dec2binm(dec,m)
binm=zeros(1,m);
digit=1;
while (dec ~= 0)
r = mod(dec,2);
dec = floor(dec/2);
binm(digit)=r;
digit=digit+1;
end