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

    %% Display Multiline Text
% Create a line plot and add one text description to the axes. Display
% multiline text by specifying |str| as a cell array.

% Copyright 2015 The MathWorks, Inc.


plot(1:10)
str = {'A simple plot','from 1 to 10'};
text(2,7,str)

%%
% Create a line plot and add two text descriptions to the axes. When adding
% multiple text descriptions to the axes, display multiline text by
% specifying nested cell arrays.

plot(1:10)
str = {{'A simple plot','from 1 to 10'},'y = x'};
text([2 8],[7 7],str)