%% Test Start of String Against Multiple Substrings
% Create a string array that contains file names. Determine which file names start with either abstract or data.
% Starting in R2017a, you can create strings using double quotes.

str = ["abstract.docx","data.tar.gz","mycode.m","results.ptx"]

%

pat = ["abstract","data"];
TF = startsWith(str,pat)

%
% Display the strings that start with either abstract or data. Index back into str using TF.

str(TF)

% Copyright 2012-2020 The MathWorks, Inc.