www.pudn.com > RS_BCM_255_223_4[1].Matlab.rar > deTObi.m, change:2007-04-15,size:426b


function out = deTObi(in,n) 
%把十进制转化成二进制,这里十进制不大于255 
 
k=length(in);  
for i=1:k 
  temp=in(i); 
  j=n; 
  yushu=zeros(1,n); 
  while temp>=2 
        yushu(j)=mod(temp,2); 
        if yushu(j)==0 
           temp=temp/2; 
        else 
           temp=(temp-1)/2; 
        end 
        j=j-1; 
  end 
  if temp==1 
      yushu(j)=1; 
  end 
  if i==1 
  out=yushu; 
  else 
  out=[out yushu]; 
  end 
end