Avoiding scientific notation with Matlab

你。 提交于 2019-11-30 15:54:28

问题


I have altready tried:

format long g;

But a number like this shows with scientific notation:

ans = 8.80173259769825e-05

How can I avoid scientific notation without using something like fprintf ?


回答1:


you can use:

sprintf('%.10f', yourNumber)

Or a more sophisticated option is to use Java-based formatting (see more info , credit to Yair Altman for showing this method), for example:

char(java.text.DecimalFormat('#.00000000').format(yourNumber));



回答2:


Go to: Preferences > Command view > Numeric Format > bank



来源:https://stackoverflow.com/questions/15512478/avoiding-scientific-notation-with-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!