%function plottingmovement(userid,


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

% Specific time periods

 %%
starta = '140827102351051';
enda = '140827102451133';

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

startb = '140827104124129';
endb = '140827104224225';


%140827101151773	10:11:51.773	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%%140827101251811	10:12:51.811	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140827101332719	10:13:32.719	Stand on left leg	Start
%140827101352765	10:13:52.766	Stand on left leg	Stop
%140827101431365	10:14:31.366	Stand on right leg	Start
%140827101451406	10:14:51.406	Stand on right leg	Stop
%140827101530391	10:15:30.391	From standing raise left arm	Start
%140827101550440	10:15:50.440	From standing raise left arm	Stop
%140827101628992	10:16:28.993	From standing raise right arm	Start
%140827101649068	10:16:49.068	From standing raise right arm	Stop
%140827101728252	10:17:28.252	From sitting extend arms forward and hold as still as possible	Start
%140827101828293	10:18:28.293	From sitting extend arms forward and hold as still as possible	Stop
%140827101919339	10:19:19.339	Sit still in chair with a back and???place arms in lap	Start
%140827102119372	10:21:19.372	Sit still in chair with a back and???place arms in lap	Stop
%140827102158333	10:21:58.333	Sit still in chair counting backwards from 200	Start
%140827102258427	10:22:58.428	Sit still in chair counting backwards from 200	Stop
%140827102351051	10:23:51.052	From sitting extend right arm forward then touch nose and repeat until time is up	Start
%140827102451133	10:24:51.134	From sitting extend right arm forward then touch nose and repeat until time is up	Stop
%140827102537000	10:25:37.000	From sitting extend left arm forward then touch nose and repeat until time is up	Start
%140827102637079	10:26:37.080	From sitting extend left arm forward then touch nose and repeat until time is up	Stop
%140827102725749	10:27:25.749	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Start
%140827102825817	10:28:25.818	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Stop

%140827102913029	10:29:13.030	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140827103013112	10:30:13.113	From standing sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140827103104246	10:31:04.246	Stand on left leg	Start
%140827103124319	10:31:24.320	Stand on left leg	Stop
%140827103204273	10:32:04.277	Stand on right leg	Start
%140827103224353	10:32:24.354	Stand on right leg	Stop
%140827103305425	10:33:05.425	From standing raise left arm	Start
%140827103325471	10:33:25.472	From standing raise left arm	Stop
%140827103406637	10:34:06.638	From standing raise right arm	Start
%140827103426685	10:34:26.686	From standing raise right arm	Stop
%140827103515214	10:35:15.215	From sitting extend arms forward and hold as still as possible	Start
%140827103615281	10:36:15.281	From sitting extend arms forward and hold as still as possible	Stop
%140827103701589	10:37:01.593	Sit still in chair with a back and???place arms in lap	Start
%140827103901688	10:39:01.689	Sit still in chair with a back and???place arms in lap	Stop
%140827103946076	10:39:46.077	Sit still in chair counting backwards from 200	Start
%140827104046168	10:40:46.169	Sit still in chair counting backwards from 200	Stop
%140827104124129	10:41:24.130	From sitting extend right arm forward then touch nose and repeat until time is up	Start
%140827104224225	10:42:24.227	From sitting extend right arm forward then touch nose and repeat until time is up	Stop
%140827104303574	10:43:03.574	From sitting extend left arm forward then touch nose and repeat until time is up	Start
%140827104403629	10:44:03.630	From sitting extend left arm forward then touch nose and repeat until time is up	Stop
%140827104447441	10:44:47.444	From sitting extend arms forward and go from both palms down to both palms face up and repeat	Start




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

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

%axis(xlim,[startx endx]);

figure('Color','w')

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

subplot(5,2,3)
plot(PD05_BodyDynTime,PD05_BodyDyn_accXonly,'r')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_accYonly,'b')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_accZonly,'g')
title('BodyDyn Acceleration (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,5)
plot(PD05_BodyDynTime,PD05_BodyDyn_gyroXonly,'r')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_gyroYonly,'b')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_gyroZonly,'g')
title('BodyDyn Gyroscope (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,2,7)
plot(PD05_E3AccelTime,PD05_E3Accel_Xonly,'r')
hold on
plot(PD05_E3AccelTime,PD05_E3Accel_Yonly,'b')
hold on
plot(PD05_E3AccelTime,PD05_E3Accel_Zonly,'g')
title('E3 Acceleration (wrist)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')



subplot(5,2,9)
plot(PD05_BHPeakAccTime,PD05_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(PD05_BHAccXYZTime,PD05_BHAccXYZ_Xonly,'r')
hold on
plot(PD05_BHAccXYZTime,PD05_BHAccXYZ_Yonly,'b')
hold on
plot(PD05_BHAccXYZTime,PD05_BHAccXYZ_Zonly,'g')
title('BioHarness Acceleration (chest)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,4)
plot(PD05_BodyDynTime,PD05_BodyDyn_accXonly,'r')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_accYonly,'b')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_accZonly,'g')
title('BodyDyn Acceleration (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,2,6)
plot(PD05_BodyDynTime,PD05_BodyDyn_gyroXonly,'r')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_gyroYonly,'b')
hold on
plot(PD05_BodyDynTime,PD05_BodyDyn_gyroZonly,'g')
title('BodyDyn Gyroscope (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,2,8)
plot(PD05_E3AccelTime,PD05_E3Accel_Xonly,'r')
hold on
plot(PD05_E3AccelTime,PD05_E3Accel_Yonly,'b')
hold on
plot(PD05_E3AccelTime,PD05_E3Accel_Zonly,'g')
title('E3 Acceleration (wrist)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')



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

