0001 function [A,numprofiles,numpoints,closed]=closeprofile(A,numprofiles,numpoints,closed,prevplot,root);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if numprofiles==0
0012 disp('no profile to be closed')
0013 return
0014 end
0015
0016 title('click on the profiles to be closed, RETURN to exit','FontSize',14)
0017 hold on
0018
0019 loop=1;
0020 selection=[];
0021
0022 while loop
0023
0024 [xi,yi] = ginput(1);
0025
0026 if ~isempty(xi)
0027
0028
0029 [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0030
0031 if ismember(profsel,selection)
0032
0033 selection(find(selection==profsel))=[];
0034
0035 plot(A(profsel).x,A(profsel).y,'-r','MarkerSize',10);
0036 else
0037
0038 selection(end+1)=profsel;
0039
0040 plot(A(profsel).x,A(profsel).y,'-b','MarkerSize',10);
0041 end
0042 else
0043
0044 for i=1:length(selection),
0045 if (A(selection(i)).x(end)~=A(selection(i)).x(1) | A(selection(i)).y(end)~=A(selection(i)).y(1))
0046 A(selection(i)).x(end+1)=A(selection(i)).x(1);
0047 A(selection(i)).y(end+1)=A(selection(i)).y(1);
0048 numpoints=numpoints+1;
0049 closed(selection(i))=1;
0050 else
0051 disp('one profile is already closed')
0052 end
0053 end
0054 loop=0;
0055 end
0056 end
0057 end