
PD04 = 'PD04';
actionname = 'PD04';

%Start axis is min value of the BH file (BH is put on first)
%startx = min(PD04_BHAccXYZTime);
%End axis is the max value of the BH file
%endx = max(PD04_BHAccXYZTime);

%use the bioharness timing to set the size of figure
settime = PD04_BHAccXYZTime;

%axis(xlim,[startx endx]);

figure('Color','w')


subplot(5,1,1)
plot(PD04_BHAccXYZTime,PD04_BHAccXYZ_Xonly,'r')
hold on
plot(PD04_BHAccXYZTime,PD04_BHAccXYZ_Yonly,'b')
hold on
plot(PD04_BHAccXYZTime,PD04_BHAccXYZ_Zonly,'g')
title('BioHarness Acceleration (chest)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,1,2)
plot(PD04_BodyDynTime,PD04_BodyDyn_accXonly,'r')
hold on
plot(PD04_BodyDynTime,PD04_BodyDyn_accYonly,'b')
hold on
plot(PD04_BodyDynTime,PD04_BodyDyn_accZonly,'g')
title('BodyDyn Acceleration (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,1,3)
plot(PD04_BodyDynTime,PD04_BodyDyn_gyroXonly,'r')
hold on
plot(PD04_BodyDynTime,PD04_BodyDyn_gyroYonly,'b')
hold on
plot(PD04_BodyDynTime,PD04_BodyDyn_gyroZonly,'g')
title('BodyDyn Gyroscope (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,1,4)
plot(PD04_QSensorDataTime,PD04_QSensorData_Xonly,'r')
hold on
plot(PD04_QSensorDataTime,PD04_QSensorData_Yonly,'b')
hold on
plot(PD04_QSensorDataTime,PD04_QSensorData_Zonly,'g')
title('QSensor Acceleration (wrist)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,1,5)
plot(PD04_BHPeakAccTime,PD04_BHPeakAcc)
title('BioHarness Peak Acceleration (chest)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM')
set(gca,'XTick',[settime(1):.025:settime(end)])
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM')

% may have to run this loop outside of the script - for unknown reasons

for i = 1:5;
subplot(5,1,i)
xlim(settime([1 end]))
set(gca,'XTick',[settime(1):.025:settime(end)])

datetick('x','HH:MM:SSPM')
grid on
grid minor
end


ha = axes('Position',[0 0 1 1],'Xlim',[0 1],'Ylim',[0 1],'Box','off','Visible','off','Units','normalized', 'clipping' , 'off');
titlename = sprintf('%s',actionname);
text(0.5, 1,titlename,'HorizontalAlignment','center','VerticalAlignment', 'top')  

hold on
