Significant figures are being trimmed when I read from a .txt file
2 次查看(过去 30 天)
显示 更早的评论
Hello, and thank you in advance for your time.
I am trying to read data from text files. The first column contains absolute time, so the data points look something like this: 3.55560341707837150E+9. However, the data is being truncated to show only this: 3.5556e+09.
It is very important that I use all of the digits, as I need to look at very small increments of time between certain points.
Here is the code I use to access the files:
[fileName1,filePath1] = uigetfile('*', 'Select force data file', '.');
force = load( fullfile(filePath1,fileName1) );
[fileName2,filePath2] = uigetfile('*', 'Select lvdt data file', '.');
volt = load( fullfile(filePath2,fileName2) );
In what way could I alter this code to ensure that all significant figures are read?
1 个评论
回答(2 个)
Stephen23
2016-9-2
编辑:Stephen23
2016-9-2
Your data is there, this is just a question of how it is displayed. Read the format documentation for other display precisions:
>> 3.55560341707837150E+9
ans =
3.5556e+09
>> format longg
>> 3.55560341707837150E+9
ans =
3555603417.07837
>> format longe
>> 3.55560341707837150E+9
ans =
3.555603417078372e+09
0 个评论
Star Strider
2016-9-2
You’re limited to 16 significant figures in MATLAB double-precision variables:
format long
Q1 = 3.55560341707837150E+9
Q1 =
3.555603417078372e+09
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!