0001 function expselect(newfile,oldfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
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
0026 [path root ext ver]=fileparts(oldfile);
0027 A=expread(oldfile,1);
0028 numprofiles=size(A,2);
0029
0030
0031 g=get(gca,'children');
0032 prevplot=length(g);
0033
0034
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
0042 numpoints=numpoints+size(A(i).x,1);
0043
0044
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
0051 [A,numprofiles,numpoints,closed]=removeprofile(A,numprofiles,numpoints,closed,prevplot,root);
0052
0053 hold off
0054
0055
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