%% Convert Character Vectors to Numbers
% Convert character vectors that represent numbers to double precision values. You can also convert a cell array of character vectors to a numeric array of the same size.
% Convert a character vector to a real number.

X = str2double('3.1416')

%
% Convert a character vector when it represents a number using exponential notation.

X = str2double('2.998e8')

%
% Convert a character vector that uses a comma as the thousands separator.

X = str2double('1,200.34')

%
% Convert a character vector to a complex number.

X = str2double('3.14 + 2.7i')

%
% Convert a cell array of character vectors to a numeric array.

str = {'2.718','3.1416';
       '137','0.015'};
X = str2double(str)

% Copyright 2012 The MathWorks, Inc.