function MeasResults = LoadMeasResults(filenm);

load(filenm);

MeasResults.meanElecPow = nanmean(SelectedData.RectifiedVoltage.*SelectedData.RectifiedCurrent);
MeasResults.SelectedData = SelectedData;

MeasResults.MeanPTOElongation = mean(0.0254*SelectedData.PistonDistance);
MeasResults.MaxPTOElongation = max(0.0254*SelectedData.PistonDistance);
MeasResults.MinPTOElongation = min(0.0254*SelectedData.PistonDistance);
MeasResults.StdPTOElongation = std(0.0254*SelectedData.PistonDistance);

PistonDistanceRate = [0 diff(SelectedData.PistonDistance)./diff(SelectedData.time)];

MeasResults.MeanPTOElongationRate = mean(0.0254*PistonDistanceRate);
MeasResults.RMSPTOElongationRate = sqrt(var(0.0254*PistonDistanceRate));
MeasResults.MaxPTOElongationRate = max(0.0254*PistonDistanceRate);
MeasResults.MinPTOElongationRate = min(0.0254*PistonDistanceRate);
MeasResults.StdPTOElongationRate = std(0.0254*PistonDistanceRate);

n_windows = 16;

t = SelectedData.time-SelectedData.time(1);
e = 0.0254*SelectedData.PistonDistance;
e = e-mean(e);
edot = [0 diff(e)./diff(t)];

[f, Pxx] = tseries2spectrum(t,e,n_windows);
idx = find(f<=1);
MeasResults.f = f(idx);
MeasResults.S_e = Pxx(idx);

[f, Pxx] = tseries2spectrum(t,edot,n_windows);
MeasResults.S_edot = Pxx(idx);

n_windows = 32;
[f, Pxx] = tseries2spectrum(t,SelectedData.RectifiedVoltage-mean(SelectedData.RectifiedVoltage),n_windows);
MeasResults.S_voltage = Pxx(idx);

[f, Pxx] = tseries2spectrum(t,SelectedData.RectifiedCurrent-mean(SelectedData.RectifiedCurrent),n_windows);
MeasResults.S_current = Pxx(idx);

[f, Pxx] = tseries2spectrum(t,SelectedData.RectifiedCurrent.*SelectedData.RectifiedVoltage-mean(SelectedData.RectifiedCurrent.*SelectedData.RectifiedVoltage),n_windows);
MeasResults.S_pow = Pxx(idx);

end

