相关代码 |
|
function out=convert(num,step,K) %num待转化的十进制数,step进制数,K转化后位数 quotient=num; conv_num=zeros(1,K); flag=0; for k=1:K if quotient>1 conv_num(k)=rem(quotient,step); quotient=floor(quotient/step); elseif quotient==1 conv_num(k)=1; quotient=0; else conv_num(k)=0; end end out=fliplr(conv_num)';
相关资源 |
|