| 1 | function [A,numprofiles,numpoints,closed]=addprofile(A,numprofiles,numpoints,closed,prevplot,root,options)
|
|---|
| 2 | %ADDPROFILE - add a profile
|
|---|
| 3 | %
|
|---|
| 4 | % this script is used by exptool as an elementary operation
|
|---|
| 5 | % on an ARGUS profile
|
|---|
| 6 | %
|
|---|
| 7 | % Usage:
|
|---|
| 8 | % [A,numprofiles,numpoints,closed]=addprofile(A,numprofiles,numpoints,closed,prevplot,root,options)
|
|---|
| 9 |
|
|---|
| 10 | title('click to add a point to the new profile, RETURN to exit','FontSize',14)
|
|---|
| 11 | hold on
|
|---|
| 12 |
|
|---|
| 13 | loop=1;
|
|---|
| 14 | x=[];
|
|---|
| 15 | y=[];
|
|---|
| 16 |
|
|---|
| 17 | while loop
|
|---|
| 18 |
|
|---|
| 19 | [xi,yi] = ginput(1);
|
|---|
| 20 |
|
|---|
| 21 | if ~isempty(xi)
|
|---|
| 22 | x(end+1,1)=xi;
|
|---|
| 23 | y(end+1,1)=yi;
|
|---|
| 24 |
|
|---|
| 25 | %plot everything
|
|---|
| 26 | undoplots(prevplot);
|
|---|
| 27 | plot(x,y,'color',getfieldvalue(options,'color'),'LineStyle',getfieldvalue(options,'LineStyle'),'LineWidth',getfieldvalue(options,'LineWidth'),...
|
|---|
| 28 | 'MarkerEdgeColor',getfieldvalue(options,'MarkerEdgeColor'),'MarkerSize',getfieldvalue(options,'MarkerSize'),'Marker',getfieldvalue(options,'Marker'));
|
|---|
| 29 | plot(x(end),y(end),'MarkerEdgeColor',getfieldvalue(options,'selectioncolor'),'MarkerSize',getfieldvalue(options,'MarkerSize'),'Marker',getfieldvalue(options,'Marker'));
|
|---|
| 30 |
|
|---|
| 31 | else
|
|---|
| 32 |
|
|---|
| 33 | %check that the profile is not empty
|
|---|
| 34 | if ~isempty(x)
|
|---|
| 35 | A(end+1).x=x;
|
|---|
| 36 | A(end).y=y;
|
|---|
| 37 | A(end).name=root;
|
|---|
| 38 | A(end).density=1;
|
|---|
| 39 | numprofiles=numprofiles+1;
|
|---|
| 40 | numpoints=numpoints+length(x);
|
|---|
| 41 | closed(end+1)=0;
|
|---|
| 42 | end
|
|---|
| 43 |
|
|---|
| 44 | %get out
|
|---|
| 45 | loop=0;
|
|---|
| 46 | end
|
|---|
| 47 | end
|
|---|
| 48 | end
|
|---|