-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnkleAnalysisStroke.m
76 lines (59 loc) · 2.63 KB
/
AnkleAnalysisStroke.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
function [ ROM ] = AnkleAnalysisStroke( subjectnumber, subfolder , ~ )
% Find the step heights and step lengths of a single patient based on the
% Average Ankle positons for a
% Filepaths for Experiment data
parentfolderavg = SelectFolder( subfolder , subjectnumber );
%% Gait Templates
[ ref ] = importGaitTemplate( parentfolderavg, '\*GaitTemplate*.txt', 3 );
%% Anklepositions
% Baseline
[ Pav ] = readAvgAnklepos( parentfolderavg, '\*freewalking*.txt', 2); %Average
% Transparent mode
[ Tav ] = readAvgAnklepos( parentfolderavg, '\*pretraining*.txt', 2 ); %Average
% Training the Stroke Patients
Assistive_FileList = rdir( [ parentfolderavg, '\*_training*.txt' ] );
for i = 1: length(Assistive_FileList)
Aavi(i) = readAvgAnklepos( Assistive_FileList(i).name, '', 2 ); %Average
Aav.x = mean( [ Aavi.x ], 2 );
Aav.y = mean( [ Aavi.y ], 2);
end
% Post training A
[ Posta ] = readAvgAnklepos( parentfolderavg, '\*posta*.txt', 2 ); %Average
% Post Training B
[ Postb ] = readAvgAnklepos(parentfolderavg, '\*postb*.txt', 2 ); %Average
% Active mode
[ Postc ] = readAvgAnklepos(parentfolderavg, '\*postc*.txt', 2 ); %Average
%% Plotting Graphs
if nargin > 2
figure, hold on
subplot(323)
plotAnklePosAll( ref, Posta )
legend(gca, 'boxoff'), set(gca, 'xcolor', 'none'); title('(a)') %Postb
title('Posta')
subplot(324)
plotAnklePosAll( ref, Postb ) %Postc
legend(gca, 'hide'), set(gca, 'ycolor', 'none'); set(gca, 'xcolor', 'none'); title('(b)')
title('Postb')
subplot(325)
plotAnklePosAll( ref, Postc ) % Transparent
legend(gca, 'hide'), title('(c)'), xlabel('x position (m)'), ylabel('y position (m)')
title('Postc')
subplot(321)
plotAnklePosAll( ref, Tav ) % Active/Training
legend(gca, 'hide'), title('(d)'), set(gca, 'ycolor', 'none')
title('Pretraining')
subplot(322)
plotAnklePosAll( ref, Aav ) % Active/Training
legend(gca, 'hide'), title('(d)'), set(gca, 'ycolor', 'none')
title('Training')
else
fprintf('Add a second input to function if plots needed.')
end
%% StepHeights
[ ROM.P ] = CalcAnkleROM( [Pav.x, Pav.y] ); %Passive
[ ROM.T ] = CalcAnkleROM( [Tav.x, Tav.y] ); %Transparent
[ ROM.A ] = CalcAnkleROM( [Aav.x, Aav.y] ); %Active/Training
[ ROM.Posta ] = CalcAnkleROM( [Posta.x, Posta.y] ); %Posta
[ ROM.Postb ] = CalcAnkleROM( [Postb.x, Postb.y] ); %Postb
[ ROM.Postc ] = CalcAnkleROM( [Postc.x, Postc.y] ); %Postc
end