%% Split Character Vector of Values on Specific Delimiter
% Split a character vector that contains comma-separated values.

data = '1.21, 1.985, 1.955, 2.015, 1.885';
C = strsplit(data,', ')

%
% Split a character vector, data, which contains the units m/s with an arbitrary number of whitespace on either side of the text. The regular expression, \s*, matches any whitespace character appearing zero or more times.

data = '1.21m/s1.985m/s 1.955 m/s2.015 m/s 1.885m/s';
[C,matches] = strsplit(data,'\s*m/s\s*',...
    'DelimiterType','RegularExpression')

% In this case, the last character vector in C is empty. This empty character vector follows the last matched delimiter.
% Copyright 2012 The MathWorks, Inc.