MATLAB: How to get rid of exponent notation from a variable output

bin2decexponent

I have to use the output as a 16 bit binary string to convert to decimal. Example : bin2dec has an error when the variable is '1.000011110100011e+16'. How can I alter this variable before using the function bin2dec.
Thank you.

Best Answer

You do not have a binary string. You have a 17 digit decimal number stored as floating point. That number is also too large to represent as an exact integer in floating point. The number which is 16 ones in a row does fit into double precision as an exact integer, but it would show up as about 1.1e+15, ten times smaller than what you have.
You should rework your code so that you never produce values that are intended to be binary in the form of decimal numbers. If you have constants in that form, switch to using strings and bin2dec