www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/ModifyTextAfterCreationExample.m
%% Modify Existing Text % Create a line plot and add two text descriptions along the line. Return % the text objects, |t|. % Copyright 2015 The MathWorks, Inc. x = linspace(-5,5); y = x.^3-12*x; plot(x,y) t = text([-2 2],[16 -16],'dy/dx = 0') %% % The |text| function creates one text object for each text description. % Thus, |t| contains two text objects. % % Change the color and font size for the first text object using |t(1)|. % Starting in R2014b, you can use dot notation to set properties. If you % are using an earlier release, use the |set| function instead. t(1).Color = 'red'; t(1).FontSize = 14;