0001 function expcut(newfile,oldfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 if nargin~=2 | nargout
0014 error('expcut usage: expcut(newfile,oldfile)')
0015 elseif ~exist(oldfile)
0016 error(['expcut error message: the file ' oldfile 'does not exist'])
0017 elseif exist(newfile),
0018 choice=input(['A file ' newfile ' already exists, do you want to modify it? (y/n)'],'s');
0019 if ~strcmpi(choice,'y'),
0020 error('no modification done ... exiting');
0021 end
0022 end
0023
0024
0025 [path root ext ver]=fileparts(oldfile);
0026 A=expread(oldfile,1);
0027 numprofiles=size(A,2);
0028
0029
0030 g=get(gca,'children');
0031 prevplot=length(g);
0032
0033
0034 hold on
0035 numpoints=0;
0036 closed=zeros(numprofiles,1);
0037 for i=1:numprofiles
0038 plot(A(i).x,A(i).y,'-r','MarkerSize',10);
0039
0040
0041 numpoints=numpoints+size(A(i).x,1);
0042
0043
0044 if (A(i).x(1)==A(i).x(end) & A(i).y(1)==A(i).y(end))
0045 closed(i)=1;
0046 end
0047 end
0048
0049
0050 [A,numprofiles,numpoints,closed]=cutarea(A,numprofiles,numpoints,closed,prevplot,root);
0051
0052 hold off
0053
0054
0055 title('New file written, exiting','FontSize',14);
0056 expwrite(A,newfile);