%function plottingmovement(userid,


PD01 = 'PD01';
actionname = 'ALL FIRSTTIME';

% Specific time periods

 %%
starta = '140819085337730';
formatIn = 'yymmddHHMMSSFFF';
%startaction = datenum(DateString,formatIn);

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



%%140819085337730		From standing, sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140819085437823		From standing, sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140819085705304		Stand on left leg	Start
%140819085725405		Stand on left leg	Stop
%140819085813322		Stand on right leg	Start
%140819085833410		Stand on right leg	Stop
%140819085923474		From standing raise left arm	Start
%140819085943555		From standing raise left arm	Stop
%140819090029438		From standing raise right arm	Start
%140819090049531		From standing raise right arm	Stop
%140819090142420		From sitting, extend arms forward and hold as still as possible	Start
%140819090242517		From sitting, extend arms forward and hold as still as possible	Stop
%140819090322236		Sit still in chair with a back and???place arms in lap	Start
%140819090522341		Sit still in chair with a back and???place arms in lap	Stop
%140819090618996		Sit still in chair counting backwards from 200	Start
%140819090719092		Sit still in chair counting backwards from 200	Stop
%140819090808941		From sitting, extend right arm forward then touch nose and repeat until time is up	Start
%140819090908998		From sitting, extend right arm forward then touch nose and repeat until time is up	Stop
%140819090955984		From sitting, extend left arm forward then touch nose and repeat until time is up	Start
%140819091056080		From sitting, extend left arm forward then touch nose and repeat until time is up	Stop
%140819091146534		From sitting, extend arms forward and go from both palms down to both palms face up and repeat	Start
%140819091246635		From sitting, extend arms forward and go from both palms down to both palms face up and repeat	Stop
%140819091343934		From standing, sit down in chair with arms crossed and get back up with arms still crossed and stay	Start
%140819091444050		From standing, sit down in chair with arms crossed and get back up with arms still crossed and stay	Stop
%140819091526002		Stand on left leg	Start
%140819091546089		Stand on left leg	Stop
%140819091629949		Stand on right leg	Start
%140819091650039		Stand on right leg	Stop
%140819091735841		From standing raise left arm	Start
%140819091755941		From standing raise left arm	Stop
%140819091839233		From standing raise right arm	Start
%140819091859325		From standing raise right arm	Stop
%140819091946419		From sitting, extend arms forward and hold as still as possible	Start
%140819092046526		From sitting, extend arms forward and hold as still as possible	Stop
%140819092146806		Sit still in chair with a back and???place arms in lap	Start
%140819092346899		Sit still in chair with a back and???place arms in lap	Stop
%140819092430986		Sit still in chair counting backwards from 200	Start
%140819092531065		Sit still in chair counting backwards from 200	Stop
%140819092615261		From sitting, extend right arm forward then touch nose and repeat until time is up	Start
%140819092715367		From sitting, extend right arm forward then touch nose and repeat until time is up	Stop
%140819092757168		From sitting, extend left arm forward then touch nose and repeat until time is up	Start
%140819092857244		From sitting, extend left arm forward then touch nose and repeat until time is up	Stop
%140819092945120		From sitting, extend arms forward and go from both palms down to both palms face up and repeat	Start
%140819093045220		From sitting, extend arms forward and go from both palms down to both palms face up and repeat	Stop



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

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

%axis(xlim,[startx endx]);

figure('Color','w')


subplot(5,1,1)
plot(PD01_BHAccXYZTime,PD01_BHAccXYZ_Xonly,'r')
hold on
plot(PD01_BHAccXYZTime,PD01_BHAccXYZ_Yonly,'b')
hold on
plot(PD01_BHAccXYZTime,PD01_BHAccXYZ_Zonly,'g')
title('BioHarness Acceleration (chest)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,1,2)
plot(PD01_BodyDynTime,PD01_BodyDyn_accXonly,'r')
hold on
plot(PD01_BodyDynTime,PD01_BodyDyn_accYonly,'b')
hold on
plot(PD01_BodyDynTime,PD01_BodyDyn_accZonly,'g')
title('BodyDyn Acceleration (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')

subplot(5,1,3)
plot(PD01_BodyDynTime,PD01_BodyDyn_gyroXonly,'r')
hold on
plot(PD01_BodyDynTime,PD01_BodyDyn_gyroYonly,'b')
hold on
plot(PD01_BodyDynTime,PD01_BodyDyn_gyroZonly,'g')
title('BodyDyn Gyroscope (ankle)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')


subplot(5,1,4)
plot(PD01_QSensorDataTime,PD01_QSensorData_Xonly,'r')
hold on
plot(PD01_QSensorDataTime,PD01_QSensorData_Yonly,'b')
hold on
plot(PD01_QSensorDataTime,PD01_QSensorData_Zonly,'g')
title('QSensor Acceleration (wrist)')
xlim(settime([1 end]))
datetick('x','HH:MM:SSPM','keepticks')



subplot(5,1,5)
plot(PD01_BHPeakAccTime,PD01_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:5;
subplot(5,1,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



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

