www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DeleteCharactersFromStartPositionExample.m

    %% Delete Substrings from String Array
% Create a string array and delete substrings from it. First, delete the 
% substring |'the '| from |str|. The |erase| function deletes both instances.
str = string({'the quick brown fox jumps';
              'over the lazy dog'})
          
%%
newStr = erase(str,'the ')

%%
% Delete multiple substrings from |str|.
match = {'the ','quick ','lazy '};
newStr = erase(str,match)