Method Reference: string.double

string: X = double (str)

Convert string array to a double array.

X = char (str) returns a double array, X, which has the same size as the input string str. All elements in str that represent real or complex numbers are converted to equivalent double values. Otherwise, NaN is returned.

Source Code: string

Example: 1

double parses numeric text back into numbers; entries that are not numbers become NaN.

 s = string ({'3.14'; '42'; 'x'})
s =
  3x1 string array

    "3.14"    
    "42"      
    "x"
 double (s)
ans =

   3.1400
  42.0000
      NaN