```Date: May 9, 2013 4:28 AM
Author: Khalid Iqbal
Subject: Overlapping Bounding Boxes Problem

Dear FriendsI am trying to draw rectangles using bounding boxes coordinates which should not overlap. I am not getting the required output. I want to draw different rectangles after removing their intersecting aspect. Please reply, it is very urgent.Matlab Code:recBox contains information [x,y,width,height]recBox=[1 5 3 2;3 4 2 4;1 10 3 2;2 9 3 2;7 5 5 4;8 6 3 2];figure(1);for n=1:size(recBox,1)     rectangle('Position',recBox(n,1:4),'EdgeColor','g','LineWidth',2);     pause(0.5);end--------------------------------------------------------------------  for j=1:size(recBox,1)-1      for k=j:size(recBox,1)          box = intersectBoxes(recBox(j,:), recBox(k,:));          recBox(j,1)=box(1);          recBox(j,2)=box(2);          recBox(j,3)=box(3);          recBox(j,4)=box(4);     endend---------------------------------------------------------------------------function box = intersectBoxes(box1, box2)%INTERSECTBOXES Intersection of two bounding boxes%%   RES = intersectBoxes(BOX1, BOX2)%%   Example:%   box1 = [5 20 5 30];%   box2 = [0 15 0 15];%   intersectBoxes(box1, box2)%   ans = 5 15 5 15%   See also%   boxes2d, drawBox, mergeBoxes% unify sizes of dataif size(box1,1) == 1    box1 = repmat(box1, size(box2,1), 1);elseif size(box2, 1) == 1    box2 = repmat(box2, size(box1,1), 1);elseif size(box1,1) ~= size(box2,1)    error('Bad size for inputs');end% compute extreme coordsmini = min(box1(:,[2 4]), box2(:,[2 4]));maxi = max(box1(:,[1 3]), box2(:,[1 3]));% concatenate result into a new box structurebox = [maxi(:,1) mini(:,1) maxi(:,2) mini(:,2)];--------------------------------------------------------------------------recBoxx=[];recBoxx=unique(recBox,'rows');for n=1:size(recBoxx,1)     rectangle('Position',recBoxx(n,1:4),'EdgeColor','r','LineWidth',2);     pause(0.5);endhold off;------------------------------------------------------------------------I am in urgency and need your help.Thanks in advanceKhalid
```