function parseEngData( inFile )

%inFID = fopen(strcat(inFile, '.txt'));
inFID = fopen(inFile);
outFID = fopen(strcat(inFile, 'EngData.txt'), 'w');
header = ['Date\tTime\tState\tComment\tDepth\t' ...
            'batt Volts\tBellows Pos\t' ...
            'LPS311 Press\tLPS311 Temp\t' ...
            'SHT21 Humidity\tSHT21 Temp\t' ...
            'LPF PV\tDiff PV\tLPF PAcc\tPress Avg\tPress Var\t' ...
            'PID SP\tPID PV\tPID Y1\tPID Y2\tPID I\tPID V\tPID U\tPID Ucps\t' ...
            'Batt Amps\t12V Amps\\r\n'];
fprintf(outFID, header);                

profileIndex= 1;
pthIndex = 1;
lpfIndex = 1;
pidIndex = 1;

%get the header line
inString = fgets(inFID);
    
while ~feof(inFID)
    inString = fgets(inFID);
    inFields = strsplit(inString, '\t', 'CollapseDelimiters', false);
    
    if strncmp(inFields{5}, 'PID', 3);
            profileDate(profileIndex, :) = inFields{2};
            profileTime(profileIndex, :) = inFields{3};
            profileDateTimeNum(profileIndex) = datenum(strcat(inFields{2}, 'T', inFields{3}));
            profileState{profileIndex} = inFields{4};
            profileComment{profileIndex} = inFields{5};
            profilePressure(profileIndex) = -str2double(inFields{6});
            bellowsPosition(profileIndex) = str2double(inFields{7});
            battVoltage(profileIndex) = str2double(inFields{8});
            battAmps(profileIndex) = str2double(inFields{34});
            twelveVAmps(profileIndex) = str2double(inFields{35});
            profileIndex = profileIndex + 1;
    end
        
    if strncmp(inFields{5}, 'PTH Message', 11)
            pthDate(pthIndex, :) = inFields{2};
            pthTime(pthIndex, :) = inFields{3};
            pthDateTimeNum(pthIndex) = datenum(strcat(inFields{2}, 'T', inFields{3}));
            pthState{pthIndex} = inFields{4};
            pthComment{pthIndex} = inFields{5};
            pthPressure(pthIndex) = -str2double(inFields{6});
            lps311Press(pthIndex) = str2double(inFields{11});
            lps311Temp(pthIndex) = str2double(inFields{12});
            sht21Humidity(pthIndex) = str2double(inFields{13});
            sht21Temp(pthIndex) = str2double(inFields{14});
 
            pthIndex = pthIndex + 1;
    end
    
    if strncmp(inFields{5}, 'SBE41 Message', 13)
            lpfDate(lpfIndex, :) = inFields{2};
            lpfTime(lpfIndex, :) = inFields{3};
            lopfDateTimeNum(lpfIndex) = datenum(strcat(inFields{2}, 'T', inFields{3}));
            lpftate{lpfIndex} = inFields{4};
            lpfComment{lpfIndex} = inFields{5};
            lpfPressure(lpfIndex) = -str2double(inFields{6});
            lpfPV(lpfIndex) = str2double(inFields{21});
            lpfDiffPV(lpfIndex) = str2double(inFields{22});
            lpfPAcc(lpfIndex) = str2double(inFields{23});
            lpfPAvg(lpfIndex) = str2double(inFields{24});
            lpfPVar(lpfIndex) = str2double(inFields{25});
   
            lpfIndex = lpfIndex + 1;
    end
    
    if strncmp(inFields{5}, 'Vel PID Values', 14)
                pidDate(pidIndex, :) = inFields{2};
                pidTime(pidIndex, :) = inFields{3};
                pidDateTimeNum(pidIndex) = datenum(strcat(inFields{2}, 'T', inFields{3}));
                pidState{pidIndex, :} = inFields{4};
                pidComment{pidIndex, :} = inFields{5};
                pidPressure(pidIndex) = -str2double(inFields{6});
                pidSP(pidIndex) = str2double(inFields{26});
                pidPV(pidIndex) = str2double(inFields{27});
                pidY1(pidIndex) = str2double(inFields{28});
                pidY2(pidIndex) = str2double(inFields{29});
                pidI(pidIndex) = str2double(inFields{30});
                pidV(pidIndex) = str2double(inFields{31});
                pidU(pidIndex) = str2double(inFields{32});
                pidUcps(pidIndex) = str2double(inFields{33});
                
                pidIndex = pidIndex + 1;
    end
    
end

yLimits = [10*floor(min(profilePressure)/10) 10];

subplot(2,2,1), plot(profileDateTimeNum, profilePressure);
set(gcf, 'units', 'normalized', 'Position', [.1, .1, .5, .5]);
set(gca, 'Ylim', yLimits);
grid;
datetick('x');
xlabel('Time (UTC +0)');
ylabel('Profile Depth (dBar)');

subplot(2,2,2);
line(profileDateTimeNum, profilePressure, 'Color', 'k')
set(gca, 'YLim', yLimits);
ax1 = gca; % current axes
ax1.XColor = 'k';
ax1.YColor = 'k';
datetick('x');

ax1_pos = ax1.Position; % position of first axes
ax2 = axes('Position', ax1_pos,...
    'XAxisLocation', 'top', ...
    'YAxisLocation', 'right', ...
    'XColor', 'r', 'YColor', 'r', ...
    'Color', 'none');
%set(gca, 'Ylim', yLimits);
line(profileDateTimeNum, bellowsPosition, 'Parent', ax2, 'Color', 'r')

grid;
set(ax1.XLabel, 'String', 'Time (UTC +0)');
set(ax1.YLabel, 'String', 'Profile Depth (dBar)');
set(ax2.YLabel, 'String', 'Bellows Position (mm)');
datetick('x');

ax=axes('Units','Normal','Position',[.0 .0 1 0.01],'Visible','off');
set(get(ax,'Title'),'Visible','on')
title(['Profile ', inFile]);

save(strcat(inFile, 'Eng.mat'));

fclose(inFID);
fclose(outFID);