0001 function [A,numprofiles,numpoints,closed]=modifyposition(A,numprofiles,numpoints,closed,prevplot,root);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if numprofiles==0
0012 disp('no profile present')
0013 return
0014 end
0015
0016 hold on
0017 loop=1;
0018
0019
0020 for i=1:numprofiles
0021 plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0022 end
0023
0024 while loop
0025
0026
0027 title('click on the point to be modified, RETURN to exit','FontSize',14)
0028 [xi,yi] = ginput(1);
0029
0030 if ~isempty(xi)
0031
0032
0033 [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0034
0035
0036 plot(A(profsel).x(indsel),A(profsel).y(indsel),'bs','MarkerSize',10);
0037
0038
0039 title('click on the new location, RETURN to exit','FontSize',14)
0040 [xi,yi] = ginput(1);
0041
0042 if ~isempty(xi)
0043
0044
0045 A(profsel).x(indsel)=xi;
0046 A(profsel).y(indsel)=yi;
0047
0048
0049 if closed(profsel)
0050 if indsel==1
0051 A(profsel).x(end)=xi;
0052 A(profsel).y(end)=yi;
0053 elseif indsel==length(A(profsel).x)
0054 A(profsel).x(1)=xi;
0055 A(profsel).y(1)=yi;
0056 end
0057 end
0058
0059
0060 undoplots(prevplot);
0061 for i=1:numprofiles
0062 plot(A(i).x,A(i).y,'-rs','MarkerSize',10);
0063 end
0064 else
0065
0066 loop=0;
0067 end
0068 else
0069
0070 loop=0;
0071 end
0072 end
0073 end