Is it possible to use STR2DOUBLE on strings with 'd' specifying the exponent?

2 views (last 30 days)
I want to convert the string '1d2' to a double using the command STR2DOUBLE in MATLAB.
>> 1d2
ans =
100
>> 1e2
ans =
100
Currently, STR2DOUBLE supports strings with 'e' preceding a power of 10 scale factor. It does not support 'd' preceding a scale factor.
The command STR2DOUBLE('1d2') returns NaN.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Feb 2016
As a workaround, please convert all strings containing 'd' preceding power of 10 scale factors to 'e'. Then, you may use the command below in MATLAB:
>> str2double('1e2')
ans =
100

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!