%function plottingmovement(userid,


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

% Specific time periods

 %%
starta = '140828093248427';
enda = '140828093348450';

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

startb = '140828095130610';
endb = '140828095230646';


%140828091951721	09:19:51.722	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140828092051775	09:20:51.775	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140828092146204	09:21:46.204	Stand on left leg	Start
%140828092206233	09:22:06.234	Stand on left leg	Stop
%140828092311487	09:23:11.487	Stand on right leg	Start
%140828092331559	09:23:31.560	Stand on right leg	Stop
%140828092417807	09:24:17.808	From standing raise left arm	Start
%140828092437843	09:24:37.844	From standing raise left arm	Stop
%140828092517675	09:25:17.675	From standing raise right arm	Start
%140828092537719	09:25:37.719	From standing raise right arm	Stop
%140828092618829	09:26:18.830	From sitting extend arms forward and hold as still as possible	Start
%140828092718867	09:27:18.868	From sitting extend arms forward and hold as still as possible	Stop
%140828092805848	09:28:05.848	Sit still in chair with a back and???place arms in lap	Start
%140828093005880	09:30:05.880	Sit still in chair with a back and???place arms in lap	Stop
%140828093102579	09:31:02.579	Sit still in chair counting backwards from 200	Start
%140828093202617	09:32:02.618	Sit still in chair counting backwards from 200	Stop
%140828093248427	09:32:48.428	From sitting extend right arm forward then touch nose and repeat until time is up	Start
%140828093348450	09:33:48.450	From sitting extend right arm forward then touch nose and repeat until time is up	Stop
%140828093428201	09:34:28.202	From sitting extend left arm forward then touch nose and repeat until time is up	Start
%140828093528240	09:35:28.240	From sitting extend left arm forward then touch nose and repeat until time is up	Stop
%140828093606954	09:36:06.954	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Start
%140828093706994	09:37:06.995	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Stop

%140828093830447	09:38:30.448	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140828093930483	09:39:30.484	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140828094010914	09:40:10.915	Stand on left leg	Start
%140828094030958	09:40:30.958	Stand on left leg	Stop
%140828094115379	09:41:15.379	Stand on right leg	Start
%140828094135407	09:41:35.407	Stand on right leg	Stop
%140828094230027	09:42:30.027	From standing raise left arm	Start
%140828094250059	09:42:50.059	From standing raise left arm	Stop
%140828094419403	09:44:19.404	From standing raise right arm	Start
%140828094439436	09:44:39.437	From standing raise right arm	Stop
%140828094519872	09:45:19.873	From sitting extend arms forward and hold as still as possible	Start
%140828094619915	09:46:19.915	From sitting extend arms forward and hold as still as possible	Stop
%140828094700792	09:47:00.793	Sit still in chair with a back and???place arms in lap	Start
%140828094900891	09:49:00.891	Sit still in chair with a back and???place arms in lap	Stop
%140828094952489	09:49:52.489	Sit still in chair counting backwards from 200	Start
%140828095052553	09:50:52.560	Sit still in chair counting backwards from 200	Stop
%140828095130610	09:51:30.610	From sitting extend right arm forward then touch nose and repeat until time is up	Start
%140828095230646	09:52:30.646	From sitting extend right arm forward then touch nose and repeat until time is up	Stop
%140828095312705	09:53:12.706	From sitting extend left arm forward then touch nose and repeat until time is up	Start
%140828095412752	09:54:12.753	From sitting extend left arm forward then touch nose and repeat until time is up	Stop
%140828095454452	09:54:54.452	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Start
%140828095554484	09:55:54.485	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Stop





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

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

%axis(xlim,[startx endx]);

figure('Color','w')

%% FIRST COLUMN
%
%
subplot(5,2,1)
plot(PD06_BHAccXYZTime,PD06_BHAccXYZ_Xonly,'r')
hold on
plot(PD06_BHAccXYZTime,PD06_BHAccXYZ_Yonly,'b')
hold on
plot(PD06_BHAccXYZTime,PD06_BHAccXYZ_Zonly,'g')
title('BioHarness Acceleration (chest)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,3)
plot(PD06_BodyDynTime,PD06_BodyDyn_accXonly,'r')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_accYonly,'b')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_accZonly,'g')
title('BodyDyn Acceleration (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,5)
plot(PD06_BodyDynTime,PD06_BodyDyn_gyroXonly,'r')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_gyroYonly,'b')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_gyroZonly,'g')
title('BodyDyn Gyroscope (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,2,7)
plot(PD06_E3AccelTime,PD06_E3Accel_Xonly,'r')
hold on
plot(PD06_E3AccelTime,PD06_E3Accel_Yonly,'b')
hold on
plot(PD06_E3AccelTime,PD06_E3Accel_Zonly,'g')
title('E3 Acceleration (wrist)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')



subplot(5,2,9)
plot(PD06_BHPeakAccTime,PD06_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(PD06_BHAccXYZTime,PD06_BHAccXYZ_Xonly,'r')
hold on
plot(PD06_BHAccXYZTime,PD06_BHAccXYZ_Yonly,'b')
hold on
plot(PD06_BHAccXYZTime,PD06_BHAccXYZ_Zonly,'g')
title('BioHarness Acceleration (chest)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,4)
plot(PD06_BodyDynTime,PD06_BodyDyn_accXonly,'r')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_accYonly,'b')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_accZonly,'g')
title('BodyDyn Acceleration (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,6)
plot(PD06_BodyDynTime,PD06_BodyDyn_gyroXonly,'r')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_gyroYonly,'b')
hold on
plot(PD06_BodyDynTime,PD06_BodyDyn_gyroZonly,'g')
title('BodyDyn Gyroscope (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,2,8)
plot(PD06_E3AccelTime,PD06_E3Accel_Xonly,'r')
hold on
plot(PD06_E3AccelTime,PD06_E3Accel_Yonly,'b')
hold on
plot(PD06_E3AccelTime,PD06_E3Accel_Zonly,'g')
title('E3 Acceleration (wrist)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')



subplot(5,2,10)
plot(PD06_BHPeakAccTime,PD06_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

