function h = drawbox(center,a,b,color); % % Draw a box and return its handle % Inputs % center = x,y locations of center % a,b = side lengths % color = optional color % % Output % h = graphic handle which can be used to move the box % error(nargchk(3,4,nargin)); if nargin < 4 color = 'b'; end; x = center(1) + (a/2)*[-1 1 1 -1 -1]; % Counter-clockwise from lower left y = center(2) + (b/2)*[-1 -1 1 1 -1]; h = plot(x,y,'Color',color);