www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SelectTextAfterSubstringExample.m
%% Select Text After Substring % Create string arrays and select text that occurs after substrings. % % Create a string. Then create a new string that occurs after the substring % |'quick '|. The |extractAfter| function selects the new text but does % not include |'quick '| in the output. str = string('The quick brown fox') %% newStr = extractAfter(str,'quick ') %% % Create a new string array from the elements of a string array. When you specify % different substrings as positions, they must be contained % in a string array or a cell array that is the same size as the input string array. str = string({'The quick brown fox jumps';'over the lazy dog'}) %% newStr = extractAfter(str,{'quick ';'the '}) %% % You also can specify one substring as a position that is applied to all % elements of the input string array.