function[p,bp,battv]= parseEngData( inFile )

inFID = fopen(inFile);
outFID = fopen(strcat(inFile, 'EngData.txt'), 'w');
header = ['Date\tTime\tState\tComment\tDepth\t' ...
            'CTD Pressure\tCTD Temperature\tCTD Salinity\t' ...
            'FLBB FL\tFLBB BB\t' ...
            'O2 Conc (uM)\tO2 Air Sat (%%)\tO2 Temperature (degC)\tO2 Cal Phase (Deg)\t' ...
            'O2 TCPhase (deg)\tO2 C1RPh (deg)\tO2 C2RPh (deg)\tO2 C1 Amp(mV)\t' ...
            'O2 C2Amp (mV)\tO2 RawTEmp (mV)\r\n'];
fprintf(outFID, header);                

profileIndex= 1;
PIDIndex = 1;


%get the header line
inString = fgets(inFID);
    
while ~feof(inFID)
    inString = fgets(inFID);
    inFields = strsplit(inString, '\t', 'CollapseDelimiters', false);
      if (strfind(inFields{5}, 'Scend ') > 0);
        if(length(inFields) >= 8)
            %disp(inString);
            
            p(PIDIndex) = -1*str2double(inFields{6});
            bp(PIDIndex) = str2double(inFields{7});
            battv(PIDIndex) = str2double(inFields{8});
            batti(PIDIndex) = str2double(inFields{34});
            i12v(PIDIndex) = str2double(inFields{35});
            PIDIndex = PIDIndex+1;
           % numCommas = length(strfind(inFields{10}, ','));
           % if(numCommas == 2)
%                 cpFields = strsplit(inFields{10}, ',', 'CollapseDelimiters', false);
%                 cpDate(cpIndex, :) = inFields{2};
%                 cpTime(cpIndex, :) = inFields{3};
%                 cpDateTimeNum(cpIndex) = datenum(strcat(inFields{2}, 'T', inFields{3}));
%                 cpState(cpIndex, :) = inFields{4};
%                 cpComment(cpIndex, :) = inFields{5};
%                 cpDepth(cpIndex) = -str2double(inFields{6});
%                 cpP(cpIndex) = str2double(cpFields{1});
%                 cpT(cpIndex) = str2double(cpFields{2});
%                 cpS(cpIndex) = str2double(cpFields{3});
%                 
% 
%            % end
%                 fprintf(outFID, '%s\t%s\t%s\t%s\t%f\t%f\t%f\t%f\r\n', ...
%                     cpDate(cpIndex,:), cpTime(cpIndex,:), cpState(cpIndex,:), cpComment(cpIndex,:), ...
%                     cpDepth(cpIndex), cpP(cpIndex), cpT(cpIndex), cpS(cpIndex));
%                 cpIndex = cpIndex + 1;
           
        end
    end
    
end

 [ax,h1,h2]=plotyy(1:size(p,2),p,1:size(bp,2),bp);
 ylabel('Depth(m)');           % puts a label on the left axis
 axes(ax(2))                  % makes the 2nd yaxis the current axis.
 ylabel('Bellows Position');    % puts a label on the right axis.
 grid on;
 
 figure(2);
  [ax,h1,h2]=plotyy(1:size(p,2),p,1:size(battv,2),battv);
 ylabel('Depth(m)');           % puts a label on the left axis
 axes(ax(2))                  % makes the 2nd yaxis the current axis.
 ylabel('BattV');    % puts a label on the right axis.
 grid on;
 
  figure(3);
  [ax,h1,h2]=plotyy(1:size(p,2),p,1:size(batti,2),batti);
 ylabel('Depth(m)');           % puts a label on the left axis
 axes(ax(2))                  % makes the 2nd yaxis the current axis.
 ylabel('BattI');    % puts a label on the right axis.
 grid on;
 
   figure(4);
  [ax,h1,h2]=plotyy(1:size(p,2),p,1:size(i12v,2),i12v);
 ylabel('Depth(m)');           % puts a label on the left axis
 axes(ax(2))                  % makes the 2nd yaxis the current axis.
 ylabel('12V I');    % puts a label on the right axis.
 grid on;
 
 