How to get rid of exponent notation from a variable output?

3 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2017-3-22
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Digital Input and Output 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by