
function dataOut = read_M1_pH_full(buoy,dep)

% You must specify buoy as 'm1-slave1', not 'm1'

if ispc
  pre = '//atlas.shore.mbari.org/';
else
  pre = '/Volumes/';
end

mydir = [pre 'oasis_coredata/deployments/' ...
  buoy '/' dep '/' buoy '/'];

fmt = ['%d%*c%f %f %d']; %the more specific, the less likely any errors
fid = fopen([mydir 'data/extAnalog2']);

%skip header
 hd='#';
 while ~isempty(strfind(hd,'#'))
   ft=ftell(fid);
   hd=fgetl(fid);
 end
 clear hd;

%read data
 fseek(fid,ft,'bof');
 data=[];
 while ~feof(fid)
   out = fscanf(fid,fmt,[4,Inf])';
   if size(out,2)==4
     data = [data; out(:,[4 1:3])];
   else
     fgetl(fid); %get the bad line and move to the next line
   end
 end
 fclose(fid);
 clear fmt fid ft out ans;

%format time
 dataOut = [datenum([data(:,1) zeros(size(data,1),1) ...
   data(:,2)+data(:,3)/1e5]) data(:,4)];
 clear data;
