请教十进制转化为二进制
谁有十进制(有小数)转化为二进制的matlab程序,发一下或帮写一下好吗?谢了<BR>回复:(ww0242074)请教十进制转化为二进制
matlab有自带的啊<BR>dec2bin(10) 将10转化成2进制数 str = <FONT color=#ff0000>dec2bin(d)</FONT> returns the <FONT color=#0000ff>binary representation of d(d的二进制)</FONT> as a string. d must be a nonnegative integer smaller than 2^52. <BR>str = dec2bin(d,n) produces a binary representation with at least n bits<BR><FONT color=#0000ff>该指令为把一个d转化为二进制的形式,返回给str。</FONT><BR><FONT color=#ff0000>bin2dec</FONT>(<FONT color=#3300ff>binarystr(二进制)</FONT>) interprets the binary string binarystr and returns the equivalent decimal number. <BR>bin2dec ignores any space (' ') characters in the input string<BR><FONT color=#3300ff>该指令为把一个2进制转化为10进制,2进制之间可以有空格,忽略。<BR><BR>但是强调的是,好象该十进制为整数,没有小数,凡是小数会被忽略的。<BR>所以带小数的要进行编程应该,至于怎么做,就不知道了。</FONT>
页:
[1]