str2double
Convert strings to double precision values
Syntax
Description
X = str2double(
converts the text instr
)str
to double precision values.str
contains text that represents real or complex numeric values.str
可以是字符向量,字符向量的单元格数组或字符串数组。如果str
是字符向量或字符串标量,然后X
is a numeric scalar. Ifstr
is a cell array of character vectors or a string array, thenX
is a numeric array that is the same size asstr
.
r的文本epresents a number can contain digits, a comma (thousands separator), a decimal point, a leading+
或者-
标志,一个e
preceding a power of 10 scale factor, and ani
或者aj
for a complex unit. You cannot use a period as a thousands separator, or a comma as a decimal point.
如果str2double
cannot convert text to a number, then it returns aNaN
value.
Examples
Input Arguments
Extended Capabilities
在R2006a之前引入