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
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

产品


版本

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by