用Matlab避免科学计数法 [英] Avoiding scientific notation with Matlab

查看:579
本文介绍了用Matlab避免科学计数法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过了:

format long g;

但是这样的数字用科学计数法表示:

But a number like this shows with scientific notation:

ans = 8.80173259769825e-05

不使用fprintf之类的方法如何避免科学计数法?

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

推荐答案

您可以使用:

sprintf('%.10f', yourNumber)

或更复杂的选择是使用基于Java的格式(查看更多信息,感谢Yair Altman展示了此方法),例如:

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));

这篇关于用Matlab避免科学计数法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆