Is it possible to use STR2DOUBLE on strings with 'd' specifying the exponent?
3 次查看(过去 30 天)
显示 更早的评论
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.
采纳的回答
MathWorks Support Team
2016-2-16
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!