%% Orient Strings Along Specified Dimension
% Create a 3-by-1 string array containing names. Starting in R2017a, you can create strings using double quotes.

names = ["Mary Butler";
         "Santiago Marquez";
         "Diana Lee"]

%
% Split the array at whitespace characters. By default, split orients the output substrings along the first trailing dimension with a size of 1. Because names is a 3-by-1 string array, split orients the substrings along the second dimension of splitNames, that is, the columns.

splitNames = split(names)

%
% To orient the substrings along the rows, or first dimension, specify the dimension after you specify the delimiter. splitNames is now a 2-by-3 string array, with the first names in the first row and the last names in the second row.

splitNames = split(names," ",1)

% Copyright 2012 The MathWorks, Inc.