0001 function [A,numprofiles,numpoints,closed]=addendprofile(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 if ~any(~closed)
0016 disp('all profiles are closed')
0017 return
0018 end
0019
0020 if numprofiles>1
0021
0022 isclosed=1;
0023 title('click on a profile, RETURN to exit','FontSize',14)
0024 while isclosed
0025 [xi,yi] = ginput(1);
0026 if ~isempty(xi)
0027
0028 [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0029 if closed(profsel)
0030 disp('selected profile is closed, make another selection')
0031 else
0032 isclosed=0;
0033 end
0034
0035 else
0036
0037 return
0038 end
0039 end
0040 else
0041 profsel=1;
0042 end
0043
0044
0045 x=A(profsel).x;
0046 y=A(profsel).y;
0047
0048
0049 hold on
0050 if length(x)
0051 plot(x,y,'-rs','MarkerSize',10);
0052 end
0053 plot(x,y,'rs','MarkerSize',10);
0054 plot(x(end),y(end),'rs','MarkerSize',14);
0055
0056
0057 loop=1;
0058
0059 while loop
0060
0061
0062 title('click to add point to the selected profile, RETURN to exit','FontSize',14)
0063 [xi,yi] = ginput(1);
0064
0065 if ~isempty(xi)
0066 x(end+1,1)=xi;
0067 y(end+1,1)=yi;
0068
0069
0070 undoplots(prevplot);
0071 if length(x)
0072 plot(x,y,'-rs','MarkerSize',10);
0073 end
0074 plot(x,y,'rs','MarkerSize',10);
0075 plot(x(end),y(end),'rs','MarkerSize',14);
0076
0077 else
0078
0079
0080 if ~isempty(x)
0081 A(profsel).x=flipud(x);
0082 A(profsel).y=flipud(y);
0083 A(profsel).name=root;
0084 A(profsel).density=1;
0085 numpoints=numpoints+length(x);
0086 end
0087
0088
0089 loop=0;
0090 end
0091 end
0092 end