matlab实现16进制到二进制的转换
(2014-01-21 18:50:45)
标签:
it |
分类: MATLAB学习 |
程序源于论坛
switch in(i)
case
{'a','A'}
in(i)=10;
case
{'b','B'}
in(i)=11;
case
{'c','C'}
in(i)=12;
case
{'d','D'}
in(i)=13;
case
{'e','E'}
in(i)=14;
case
{'f','F'}
in(i)=15;
otherwise
in(i)=in(i)-48;
%ASCii值转换(16进制1对应ASCii值为49)
end
out((i-1)*4+1)=floor(in(i)/8);
out((i-1)*4+2)=mod(floor(in(i)/4),2);
out((i-1)*4+3)=mod(floor(in(i)/2),2);
out((i-1)*4+4)=mod(in(i),2);
function
out=hex_to_binary(in)
n=length(in);
for i=1:n
end
end
前一篇:[转载]GPS静态测量数据处理