str2double
Convert strings to double precision values
Syntax
Description
Note
Calling string and then double is recommended over
                            str2double because it provides greater flexibility
                        and allows vectorization. For additional information, see Alternative Functionality.
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.
Examples
Input Arguments
Alternative Functionality
Update code that makes use of str2double to use string and then double instead. Using double to convert a
                char array produces an array of the corresponding Unicode® values. Text in strings does not convert in this way. For example:
| Not Recommended | Recommended | 
|---|---|
| x = str2double('13')x =
    13 | x = double(string('13'))x =
    13 | 
Extended Capabilities
Version History
Introduced before R2006a