Is it possible to use STR2DOUBLE on strings with 'd' specifying the exponent?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 11 Jun 2010
Commented: Walter Roberson
on 16 Feb 2016
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
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
1 Comment
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!