MATLAB: Convert 0.008 to binary

binarydecimal

Since the function dec2bin only works for integers, how can I convert 0.008 to binary?

Best Answer

There are several submission in the File Exchange that do this. I have not used any of them, but here is one that is highly rated: http://www.mathworks.com/matlabcentral/fileexchange/13899-floating-number-conversion-to-binary-and-vice-versa
As Walter mentions, you need to take care about competing conventions.