Matlab:如何显示“真实";数组的值? [英] Matlab: how to display the "real" values of an array?
问题描述
我有一个在脚本中计算的向量.
I have a vector that is caluculated in a script.
计算后,我将值显示到命令窗口.显示如下:
After calculation, I display the values to the command window. It is displayed as follows:
finalResults =
1.0e+05 *
0.0001
0
0.0005
0.0002
0.0001
0.0027
0.0033
0.0001
-0.0000
-0.0000
1.3750
0.0066
我如何使它与 real 值一起显示(即与 1.0e+05
相乘)?
How do I make it display with the real values (i.e. with the 1.0e+05
multiplied in)?
推荐答案
format longG
应该可以解决问题.这使用 long
或 longE
,以较短者每个元素为准.如果您想要更短的序列,也可以使用 format shortG
来完成.
format longG
should do the trick. This uses either long
or longE
, whichever is shorter for each element. Same can be done with format shortG
if you want shorter sequences.
MATLAB 在您的问题中显示数字的原因是因为这是 format short
的处理方式.查看文档中的 format
以查看所有选项.
The reason MATLAB displays numbers like in your question, is because this is the format short
way of doing things. Look at format
in the documentation to see all the options.
例子:
format shortG
A = [1;1e10;-1];
A =
1
1e+10
-1
format longG
A =
1
10000000000
-1
这篇关于Matlab:如何显示“真实";数组的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!