%% Split String Array with Missing Data Between Delimiters
% Create a string array in which each element contains comma-delimited data about a patient. Starting in R2017a, you can create strings using double quotes.

patients = ["LastName,Age,Gender,Height,Weight";
            "Adams,47,F,64,123";
            "Jones,,,68,175";
            "King,,M,66,180";
            "Smith,38,F,63,118"]

%
% Split the string array. A pair of commas with nothing between them indicates missing data. When split divides on repeated delimiters, it returns empty strings as corresponding elements of the output array.

patients = split(patients,",")

% Copyright 2012 The MathWorks, Inc.