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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Input and Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!