%text(0.5*mPoint1+0.5*mPoint2,mText-0.5,Word); hold on x1=mPoint1;y1=mText-1; x2=mPoint2;y2=mText-1; x3=mPoint2;y3=mText; x4=mPoint1;y4=mText; %fill([x1,x2,x3,x4],[y1,y2,y3,y4],'r'); fill([x1,x2,x3,x4],[y1,y2,y3,y4],[1,0.5,1]); text(0.5*mPoint1+0.5*mPoint2,mText-0.5,Word); end end end function PlotRec(mPoint1,mPoint2,mText) %此函数画出小矩形%输入:% mPoint1 输入点 1,较小,横坐标% mPoint2 输入点 2,较大,横坐标% mText 输入的文本,序号,纵坐标 vPoint = zeros(4,2) ; vPoint(1,:) = [mPoint1,mText-1]; vPoint(2,:) = [mPoint2,mText-1]; vPoint(3,:) = [mPoint1,mText]; vPoint(4,:) = [mPoint2,mText]; plot([vPoint(1,1),vPoint(2,1)],[vPoint(1,2),vPoint(2,2)]); hold on ; plot([vPoint(1,1),vPoint(3,1)],[vPoint(1,2),vPoint(3,2)]); plot([vPoint(2,1),vPoint(4,1)],[vPoint(2,2),vPoint(4,2)]); plot([vPoint(3,1),vPoint(4,1)],[vPoint(3,2),vPoint(4,2)]);