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

    %% Split Character Vector at Newlines
% Create a character vector and split it at newline characters. The
% |newline| function returns the newline character, |char(10)|.
chr = 'Whose woods these are I think I know.'; 
chr = [chr newline 'His house is in the village though;']

%%
% |splitlines| returns the text as a string array even though |chr| is a
% character vector, because the string array contains more pieces of text.
str = splitlines(chr)