addendprofile

PURPOSE ^

ADDENDPROFILE - add point at the end of a n existing profile

SYNOPSIS ^

function [A,numprofiles,numpoints,closed]=addendprofile(A,numprofiles,numpoints,closed,prevplot,root);

DESCRIPTION ^

ADDENDPROFILE - add point at the end of a n existing profile

   this script is used by expmaster as an elementary operation
   on an ARGUS profile

   Usage:
      [A,numprofiles,numpoints,closed]=addendprofile(A,numprofiles,numpoints,closed,prevplot,root)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [A,numprofiles,numpoints,closed]=addendprofile(A,numprofiles,numpoints,closed,prevplot,root);
0002 %ADDENDPROFILE - add point at the end of a n existing profile
0003 %
0004 %   this script is used by expmaster as an elementary operation
0005 %   on an ARGUS profile
0006 %
0007 %   Usage:
0008 %      [A,numprofiles,numpoints,closed]=addendprofile(A,numprofiles,numpoints,closed,prevplot,root)
0009         
0010     %some checks
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     %select a profile first
0020     if numprofiles>1
0021         %first step, select a profile
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                 %get the closest point
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                 %RETURN -> out
0037                 return
0038             end
0039         end
0040     else
0041         profsel=1;
0042     end
0043 
0044     %initialize x and y
0045     x=A(profsel).x;
0046     y=A(profsel).y;
0047 
0048     %plot the selected profile
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         %first step, select a profile
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             %plot everything
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             %check that the profile is not empty
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             %get out
0089             loop=0;
0090         end
0091     end
0092 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003