-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcessBB.m
125 lines (90 loc) · 3.56 KB
/
ProcessBB.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
%% RUN BODY BUILDER DATA EXTRACTION
% Prasanna Sritharan, April 2018
%
% Last updated: August 2020
%
% --------------------------------------------------------------------
% Copyright (C) 2018 Prasanna Sritharan
% Copyright (C) 2018 La Trobe University
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% --------------------------------------------------------------------
clc;
disp('C3D BODY BUILDER DATA EXTRACTION');
disp('Prasanna Sritharan, June 2017');
disp(' ');
disp([datestr(now) ': Execution commenced.']);
disp(' ');
disp(' ');
disp('===========================================================');
disp(' ');
%% ********************
% SCRIPT SETTINGS
% get user script settings
disp('Retrieving script settings...');
user = getUserScriptSettings();
% get Body Builder defaults
disp('Retrieving Body Builder C3D metadata...');
bbmeta = getBBmeta();
%% ********************
% CREATE DATA STRUCT
disp(' ');
% generate C3D file list
disp('Generating list of available C3D files matching file name format...');
[flist,fnames,subtri] = generateFileList(user);
% add additional information about trial (metadata)
disp('Generating subject and trial metadata and settings...');
bb = getSubjTrialMeta(flist,subtri,bbmeta,user);
% --------------------------------------
% Mark Scholes Running Data only
% update ignore flag to ignore non-gaitcycle trials
disp(' ');
disp('Updating ignore flags for non-gaitcycle trials (Mark Scholes FAILT running data only)...');
bb = gcUpdateIgnore(bb,bbmeta,user);
% --------------------------------------
%% ********************
% EXTRACT & PROCESS BODY BUILDER DATA
disp(' ');
% pull raw Body Builder data into a struct, trim and resample
disp('Extracting Body Builder data from C3D files...');
bb = extractBBdata(bb,bbmeta,user);
% calculate mean and sd for BB data
disp('Calculating means and standard deviations for Body Builder data...');
bb = calcBBmean(bb,bbmeta,user);
%% ********************
% ADDITIONAL ANALYSES
disp(' ');
% run additional analyses on Body Builder data
disp('Running additional analyses on Body Builder data...');
bb = runAnalyses(bb,bbmeta,user);
% calculate mean and sd for additional analyses
disp('Calculating means and standard deviations for additional analyses...');
bb = calcAnalysesMeans(bb,bbmeta,user);
%% ********************
% SAVE TO FILE
disp(' ');
% export to Excel spreadsheet from Body Builder struct
disp('Exporting Body Builder and analyses data to Excel spreadsheet...');
exportData(bb,bbmeta,user);
% calculate and export average ground speeds
disp('Calculating and exporting means and standard deviations for ground speed...');
calcExportGroundSpeedMeans(bb,bbmeta,user);
% save Body Builder struct
disp('Saving complete data set (Body Builder data and additional analyses) as Matlab struct...');
saveBBstruct(bb,user);
%% ********************
disp(' ');
disp([datestr(now) ': Execution complete.']);
disp('-----------------------------------------------------------');
disp(' ');