% This program is written to remove duplicate times from a file
% in an interactive mode to see what was wrong that we got duplicate
% times to begin with.
type=input('Enter the type of file (1=Met,2=CTD,3=Tstring,4=ADCP): ');
fname=input('Enter the whole path and name of the file to work on: ','s');
eval(['load ',fname,';']);
switch type,
	case 1,
		a=metf;
		b=metn;
		v=2;
	case 2,
		a=ctdf;
		b=ctdn;
		v=3;
% add cases for ADCP and Microcats later
end
lb=size(b,1);
newb=[];
newa=[];
for i=1:lb-1,
	if((b(i+1,1)-b(i,1))==0),
%		disp([b(i+1,1) b(i,1)]);
%		disp([b(i+1,v) b(i,v)]);
%		yn=input('Remove current point? ','s');
%		if((yn=='y')|(yn=='Y')),
%			do nothing
%		else,
%			newb=[newb
%			      b(i,:)];
%			newa=[newa
%			      a(i,:)];
%		end
	else,
		newb=[newb
		      b(i,:)];
		newa=[newa
		      a(i,:)];
	end
end
newb=[newb
      b(i+1,:)];
newa=[newa
      a(i+1,:)];
switch type,
	case 1,
		metn=newb;
		metf=newa;		
		eval(['save ',fname,'.mat metn metf;']);
	case 2,
		ctdn=newb;
		ctdf=newa;
		eval(['save ',fname,'.mat ctdn ctdf;']);
end
