www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/TestStartOfStringAgainstMultiplePatternsExample.m
%% Test Start of String Against Multiple Patterns % Create a string array that contains file names. Determine which file names % start with either |abstract| or |data|. str = string({'abstract.docx','data.tar.gz','mycode.m','results.ptx'}) %% pattern = {'abstract','data'}; TF = startsWith(str,pattern) %% % Display the strings that start with either |abstract| or |data|. Index back % into |str| using |TF|. str(TF)