% MCTPS07_PROC
% The 2007 International Workshop on 
% Mobile Computing Technologies for Pervasive Healthcare
% December 10, 2007, Phillip Island, Melbourne, Australia
% Collected with PS(C#) and Tmote gateway
%
% Emil Jovanov
% University of Alabama in Huntsville
% December 2007. 
%

% Directory path and session number definition
% note: change if necessary
dir_path='c:\Data\Actis_data\mctps_Melbourne07';
sess_no=74;

% Raw data sampling frequency
Fs=25;

% display collection record stats
[NFiles,no_rec,PacCntr]=actis_file_stats(dir_path,sess_no)

% extract user's activity estimate
[AEE,St_aee,no_rec_aee,lost_rec_aee]=actis_read_AEE(dir_path,1,sess_no);

% extract Rpeak events
[RR,St_rr,no_rec_rr,lost_rec_rr]=actis_read_RR(dir_path,3,sess_no);

subplot(211)
bar(St_aee/60,AEE),title('Activity (AEE)')
subplot(212)
plot(St_rr./60,60*32768./RR),axis([min(St_rr)./60 max(St_rr./60) 40 140]),title('Heart rate')

% extract raw accelerometer data
[X,Xt]=actis_read('c:\Data\actis_data\mctps_Melbourne07\',37,1,0,Fs);
[Y,Yt]=actis_read('c:\Data\actis_data\mctps_Melbourne07\',37,1,1,Fs);
[Z,Zt]=actis_read('c:\Data\actis_data\mctps_Melbourne07\',37,1,2,Fs);

% plot raw data
figure
plot(Xt./60,X,Yt./60,Y,Zt./60,Z)
axis([min([Xt Yt Zt]./60) max([Xt Yt Zt]./60) 4000 14000])
title('Raw accelerometer data')
