How to convert string to double with powers?

2 Ansichten (letzte 30 Tage)
Ocean Wan
Ocean Wan am 9 Nov. 2017
Beantwortet: Walter Roberson am 9 Nov. 2017
>> str2double('0.88D+02')
ans =
NaN
I want to convert string '0.88D+02' to double 88 or 0.88D+02. However, When I use the above codes, it returns Nan. It works when I use str2num, but the length is too short. I can't convert long decimal number.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Nov. 2017
str2double( regexprep('0.88D+02', 'D', 'E') )

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by