expselect

PURPOSE ^

EXPSELECT - allow to select some profiles

SYNOPSIS ^

function expselect(newfile,oldfile)

DESCRIPTION ^

EXPSELECT - allow to select some profiles

   this routine reads the profiles of oldfile
   and enables the user to select the profiles 
   that he/she wants to keep in newfile

   Usage:
      expselect(newfile,oldfile)

   See also EXPMASTER, EXPDOC

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function expselect(newfile,oldfile)
0002 %EXPSELECT - allow to select some profiles
0003 %
0004 %   this routine reads the profiles of oldfile
0005 %   and enables the user to select the profiles
0006 %   that he/she wants to keep in newfile
0007 %
0008 %   Usage:
0009 %      expselect(newfile,oldfile)
0010 %
0011 %   See also EXPMASTER, EXPDOC
0012  
0013 %Some checks
0014 if nargin~=2 | nargout
0015     error('expselect usage: expselect(newfile,oldfile)')
0016 elseif ~exist(oldfile)
0017     error(['expselect error message: the file ' oldfile  'does not exist'])
0018 elseif exist(newfile),
0019     choice=input(['A file ' newfile ' already exists, do you want to modify it? (y/n)'],'s');
0020     if ~strcmpi(choice,'y'),
0021         error('no modification done ... exiting');
0022     end
0023 end
0024 
0025 %Get exp oldfile
0026 [path root ext ver]=fileparts(oldfile);
0027 A=expread(oldfile,1);
0028 numprofiles=size(A,2);
0029 
0030 %Figure out how nany plots have been done so far
0031 g=get(gca,'children'); 
0032 prevplot=length(g);
0033 
0034 %plot existing profile
0035 hold on
0036 numpoints=0;
0037 closed=zeros(numprofiles,1);
0038 for i=1:numprofiles
0039     plot(A(i).x,A(i).y,'-r','MarkerSize',10);
0040 
0041     %update numpoints
0042     numpoints=numpoints+size(A(i).x,1);
0043 
0044     %figure out if the profile is closed or not
0045     if (A(i).x(1)==A(i).x(end) & A(i).y(1)==A(i).y(end))
0046         closed(i)=1;
0047     end
0048 end
0049 
0050 %call merge profile routine
0051 [A,numprofiles,numpoints,closed]=removeprofile(A,numprofiles,numpoints,closed,prevplot,root);
0052 
0053 hold off
0054 
0055 %write contour using expwrite
0056 title('New file written, exiting','FontSize',14);
0057 if isempty(A)
0058     disp('Profile empty, no file written')
0059 else
0060     expwrite(A,newfile);
0061 end

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