function [T,c,z,datenumber]=seabirdread_Aug10;
% SeaBirdRead.m
%
% Function to read in the Sea-Bird SBE39 *.ASC data files.
%
% [T,c,z,datenumber]=seabirdread_Aug10;
%
% OUTPUTS:  T   - Temperature (C)
%           c   - sound speed (m/s) as calculated by Chen/Milero
%           z   - depth (m)
%           date- time (MatLab datenumber format)
%
global A line
fid=fopen('OC4270_Aug10.asc','r');
if fid<3, error('File did not open correctly!'); end;
i=1;
line=fgetl(fid);
header=line;        % First line contains header info
while ~strcmp(line,'*END*');
    line=fgetl(fid);
end;
line=fgetl(fid);    % READ start time
line=fgetl(fid);    % READ sample interval
line=fgetl(fid);    % READ start sample number
line=fgetl(fid);    % READ 1st line of data
while line ~=-1,         % at EndOfFile, line=-1,
    A=sscanf(line,'%f,%f,%f,%f, %d %3s %d, %02d:%02d:%02d\n');
    T(i)=A(1);  % Temperature (deg C)
    C(i)=A(2);  % Conductivity
    z(i)=A(3);  % Depth (m)
    c(i)=A(4);  % Sound speed (m/s)
    datenumber(i)=datenum(line(length(line)-21:length(line)));
    line=fgetl(fid);
    i=i+1;
end; % EOF reached
fclose(fid);
z=depth(z,36.5);