clear all
close all

fileName = '2016-11-22T21-54-45.eng'

data = importfile(fileName);

dataDateTime = datenum(data{:,'Date'}) + datenum(char(data{:,'Time'}));

power = data{:,'BattVolt'} .* data{:,'BattAmps'};
powerDateTime = datenum(data{~isnan(power),'Date'}) + datenum(char(data{~isnan(power),'Time'}));
power = power(~isnan(power));

pressure = data{:,'RawPress'};
pressureDateTime = datenum(data{~isnan(pressure),'Date'}) + datenum(char(data{~isnan(pressure),'Time'}));
pressure = pressure(~isnan(pressure));

plotyy(pressureDateTime, pressure, powerDateTime, power)
datetick('x')

energy = power(1:end-1) .* (powerDateTime(2:end) - powerDateTime(1:end-1));
energy = energy * 24 * 3600;
totalEnergy = sum(energy);
fprintf(1, 'Total Energy this profile = %.0f Joules\n', totalEnergy);