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

    %% Polygons Using Structure
% Use a structure to create two polygons. First, create a structure with
% fields names that match patch property names. Then, use the structure to
% create the polygons.

% Copyright 2015 The MathWorks, Inc.


clear S
S.Vertices = [2 4; 2 8; 8 4; 5 0; 5 2; 8 0];
S.Faces = [1 2 3; 4 5 6];
S.FaceVertexCData = [0; 1];
S.FaceColor = 'flat';
S.EdgeColor = 'red';
S.LineWidth = 2;
figure
patch(S)