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

    %% Modify Rectangle After Creation
% Add a rectangle to the current axes and return the rectangle object, |r|.

% Copyright 2015 The MathWorks, Inc.


r = rectangle('Position',[0 0 1 1]')

%%
% Modify the rectangle after creation using |r|. Change the fill color,
% outline color, and outline width.

r.FaceColor = [0 .5 .5];
r.EdgeColor = 'b';
r.LineWidth = 3;