Data type Conversion problem

3 ビュー (過去 30 日間)
Swarnava Pramanik
Swarnava Pramanik 2015 年 3 月 31 日
編集済み: James Tursa 2015 年 3 月 31 日
I've a text file which contain a data '0.3937847, 0.9727726433E+000' .When I'm trying to store the data using str2double, the data's are getting converted automatically to 0.3938 and 0.9728 respectively. But I need the accurate data to do my further calculation. How can I get the accurate data ? Please help.
Thanks,
Swarnava Pramanik

回答 (1 件)

James Tursa
James Tursa 2015 年 3 月 31 日
編集済み: James Tursa 2015 年 3 月 31 日
This is just a display issue. The accuracy is still there in the background. E.g.,
>> format short % display only first 4 digits
>> x = 0.3937847
x =
0.3938
>> y = 0.9727726433E+000
y =
0.9728
>> format long % display all the digits
>> x
x =
0.393784700000000
>> y
y =
0.972772643300000

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by