将字符串转换为matlab中的高精度数字 [英] Convert string to high precision number in matlab
问题描述
[y] = textread('report.txt','%f')
我尝试将%f
更改为%0.6f
,但仍然不起作用。
然后我尝试读取文件为%s
,并使用 str2double
,结果相同。
0.004586只是0.0045
请帮帮我
code> format 来改变精度。
$ b
格式函数会影响只有数字显示在命令窗口中,而不是MATLAB如何计算或保存它们。
$ b
查看当前格式: get(0,'format')
将当前会话中的当前格式设置为 long
使用: format long
使用以下命令将当前格式设置为 long
: set(0,'Format',long)
$ b $ long
格式提供双精度值的小数点后15位数字,
键入帮助格式
以获取更多详细信息。
I have a file with data values of the order 10^(-6).When I try to read it in matlab, it just give me accuracy of 10^(-4).I used like below,
[y]=textread('report.txt','%f')
I tried to change %f
to %0.6f
, but still it does not work.
Then I try to read file as %s
and use str2double
, again same result.
0.004586 is just 0.0045 Please help me
Use format
to change the precision.
The format
function affects only how numbers display in the Command Window, not how MATLAB computes or saves them.
View current format: get(0,'format')
Set current format in present session to long
using: format long
Set current format to long
for successive session using : set(0,'Format',long)
long
format offers 15 digits after the decimal point for double values, and 7 digits after the decimal point for single values.
Type help format
for more details.
这篇关于将字符串转换为matlab中的高精度数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!