%function plottingmovement(userid,


PD04 = 'PD04';
actionname = 'From sitting, extend right arm forward then touch nose and repeat until time is up';

% Specific time periods

 %%
starta = '140826085225453';
enda = '140826085325531';

%formatIn = 'yymmddHHMMSSFFF';
%endaction = datenum(DateString,formatIn);
date_frmt = 'yymmddHHMMSSFFF';

startb = '140826091053541';
endb = '140826091153628';


%140826084002382	08:40:02.383	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140826084102452	08:41:02.452	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140826084145313	08:41:45.314	Stand on left leg	Start
%140826084205387	08:42:05.388	Stand on left leg	Stop
%140826084250742	08:42:50.742	Stand on right leg	Start
%140826084310839	08:43:10.839	Stand on right leg	Stop
%140826084410190	08:44:10.190	From standing raise left arm	Start
%140826084430286	08:44:30.286	From standing raise left arm	Stop
%140826084512936	08:45:12.936	From standing raise right arm	Start
%140826084533018	08:45:33.019	From standing raise right arm	Stop
%140826084619329	08:46:19.330	From sitting extend arms forward and hold as still as possible	Start
%140826084719405	08:47:19.406	From sitting extend arms forward and hold as still as possible	Stop
%140826084800698	08:48:00.698	Sit still in chair with a back and???place arms in lap	Start
%140826085000760	08:50:00.760	Sit still in chair with a back and???place arms in lap	Stop
%140826085044855	08:50:44.855	Sit still in chair counting backwards from 200	Start
%140826085144940	08:51:44.940	Sit still in chair counting backwards from 200	Stop
%140826085225453	08:52:25.453	From sitting extend right arm forward then touch nose and repeat until time is up	Start
%140826085325531	08:53:25.532	From sitting extend right arm forward then touch nose and repeat until time is up	Stop
%140826085417110	08:54:17.110	From sitting extend left arm forward then touch nose and repeat until time is up	Start
%140826085517191	08:55:17.192	From sitting extend left arm forward then touch nose and repeat until time is up	Stop
%140826085600903	08:56:00.903	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Start
%140826085700980	08:57:00.981	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Stop

%140826085745769	08:57:45.774	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140826085845849	08:58:45.849	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140826085941905	08:59:41.905	Stand on left leg	Start
%140826090001992	09:00:01.993	Stand on left leg	Stop
%140826090046180	09:00:46.180	Stand on right leg	Start
%140826090106267	09:01:06.268	Stand on right leg	Stop
%140826090156920	09:01:56.920	From standing raise left arm	Start
%140826090216991	09:02:16.991	From standing raise left arm	Stop
%140826090306150	09:03:06.150	From standing raise right arm	Start
%140826090326235	09:03:26.236	From standing raise right arm	Stop
%140826090407317	09:04:07.318	From sitting extend arms forward and hold as still as possible	Start
%140826090507388	09:05:07.388	From sitting extend arms forward and hold as still as possible	Stop
%140826090549977	09:05:49.977	Sit still in chair with a back and???place arms in lap	Start
%140826090750071	09:07:50.071	Sit still in chair with a back and???place arms in lap	Stop
%140826090913019	09:09:13.019	Sit still in chair counting backwards from 200	Start
%140826091013100	09:10:13.100	Sit still in chair counting backwards from 200	Stop
%140826091053541	09:10:53.541	From sitting extend right arm forward then touch nose and repeat until time is up	Start
%140826091153628	09:11:53.628	From sitting extend right arm forward then touch nose and repeat until time is up	Stop
%140826091234901	09:12:34.901	From sitting extend left arm forward then touch nose and repeat until time is up	Start
%140826091334997	09:13:34.998	From sitting extend left arm forward then touch nose and repeat until time is up	Stop
%140826091420538	09:14:20.539	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Start
%140826091520631	09:15:20.632	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Stop



 title ('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')

%% FIRST COLUMN
%
%
subplot(5,2,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,2,3)
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,2,5)
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,2,7)
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,2,9)
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')

for i = [1,3,5,7,9];
subplot(5,2,i)
%set(gca,'XTick',[settime(1):.025:settime(end)])
%xlim(settime([1 end]))
%datetick('x','HH:MM:SSPM')

    axes_handle = gca;
    %datetick
    %%
    set(axes_handle,'XLim', ... 
         [datenum(starta,date_frmt),datenum(enda,date_frmt)])
     
    %datetick('x','HH:MM:SSPM','keepticks')
    grid on
    grid minor

end


%% SECOND COLUMN
%
subplot(5,2,2)
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,2,4)
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,2,6)
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,2,8)
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,2,10)
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')

for i = [2,4,6,8,10];
subplot(5,2,i)
%set(gca,'XTick',[settime(1):.025:settime(end)])
%xlim(settime([1 end]))
%datetick('x','HH:MM:SSPM')

    axes_handle = gca;
    %datetick
    %%
    set(axes_handle,'XLim', ... 
         [datenum(startb,date_frmt),datenum(endb,date_frmt)])
     
    %datetick('x','HH:MM:SSPM','keepticks')
    grid on
    grid minor

end


    %%
    %t = [ datenum(starta,date_frmt) : 1/(24*60) : ... 
     %     datenum(enda,date_frmt) ];

    %%
  
    
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

