closeprofile

PURPOSE ^

CLOSEPROFILE - close one or several profile

SYNOPSIS ^

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

DESCRIPTION ^

CLOSEPROFILE - close one or several profile

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

   Usage:
      [A,numprofiles,numpoints,closed]=closeprofile(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]=closeprofile(A,numprofiles,numpoints,closed,prevplot,root);
0002 %CLOSEPROFILE - close one or several 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]=closeprofile(A,numprofiles,numpoints,closed,prevplot,root)
0009 
0010     %some checks
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             %get closest profile
0029             [profsel indsel]=closestpoint(A,numprofiles,xi,yi);
0030 
0031             if ismember(profsel,selection)
0032                 %profile was in selection, close it
0033                 selection(find(selection==profsel))=[];
0034                 %back to red
0035                 plot(A(profsel).x,A(profsel).y,'-r','MarkerSize',10);
0036             else
0037                 %add the profile to the list to be closed
0038                 selection(end+1)=profsel;
0039                 %in blue
0040                 plot(A(profsel).x,A(profsel).y,'-b','MarkerSize',10);
0041             end
0042         else
0043             %close the profiles
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

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