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

    %% Split Text at Delimiter Using split Keyword  
% Split a character vector into several substrings, where each substring is delimited
% by a |^| character.   

%%  
str = ['Split ^this text into ^several pieces'];
expression = '\^';
splitStr = regexp(str,expression,'split') 

%%
% Because the caret symbol has special meaning in regular expressions, precede
% it with the escape character, a backslash (|\|). To split a character vector at
% other delimiters, such as a semicolon, you do not need to include the
% backslash.