Educational materials

MATLAB: drawRectangle

Credit: Dr. Pat Flynn

Source Code

function rc = drawRectangle(x, y, w, h, col)
%   usage:    rc = drawRectangle (x, y, w, h)
%   alternate:    rc = drawRectangle (x, y, w, h, color)
%   purpose:   Draws a filled rectangle, with the lower left hand corner  at point (x, y) 
%             with width w and height h; w and h may be negative.  It returns a 
%             handle to the rectangle being created. If present, color specifies the color 
%             of the rectangle.  If not specified, red will be used.

x1 = x;
x2 = x + w;
y1 = y;
y2 = y + h;
if nargin < 5
    col = 'red';
end
rc = fill
r1 - 18 Sep 2007 - 18:55:15 - AaronStriegel
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Syndicate this site RSSATOM