Convert strings to double precision values
X = str2double(
converts
the text in str
)str
to double precision values. str
contains
text that represents real or complex numeric values. str
can
be a character vector, a cell array of character vectors, or a string
array. If str
is a character vector or string scalar,
then X
is a numeric scalar. If str
is
a cell array of character vectors or a string array, then X
is
a numeric array that is the same size as str
.
Text that represents a number can contain digits, a comma (thousands
separator), a decimal point, a leading +
or -
sign,
an e
preceding a power of 10 scale factor, and
an i
or a j
for a complex unit.
You cannot use a period as a thousands separator, or a comma as a
decimal point.
If str2double
cannot convert text to a number,
then it returns a NaN
value.