- d=ones(100,16);
- for i=1:100
- if C(1,i)==1
- k=1;
- for j=1:100
- if C(1,j)==0
- d(i,k)=distance(X(i),X(j),Y(i),Y(j));
- k=k+1;
- end
- end
- minval=min(d(i,:));
- rr=find(d(i,:))==minval;
- m=0;
- for j=1:100
- if C(1,j)==0
- m=m+1;
- if m==rr;
- w=j;
- end
- end
- end
- x=[X(i),X(w)];
- y=[Y(i),Y(w)];
- plot(x,y)
- end
- end