%% Convert Strings That Represent Numbers
% Create a string array in which each element represents a number. To convert the string array to a numeric array, use the double function.

str = ["256","3.1416","8.9e-3"]

%

X = double(str)

%
% When the input argument is a string array, the double function treats each element as the representation of a floating-point value. However, when the input is a character array, double instead converts each character to a number representing its Unicode® value.
% As an alternative, use the str2double function. str2double is suitable when the input argument might be a string array, character vector, or cell array of character vectors.

Y = str2double(str)

%

C = '2.7183';
Z = str2double(C)

% Copyright 2012 The MathWorks, Inc.