-
Notifications
You must be signed in to change notification settings - Fork 1
/
autoWalkingSpeed.m
75 lines (56 loc) · 1.87 KB
/
autoWalkingSpeed.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
Combination = 1;
validate = [1:8, 12, 14:15, 17:20, 22, 24:27, 29];
for case_ind = 1 : length(validate)
subjectNum = validate(case_ind);
if( subjectNum < 10 )
number = strcat('0', int2str(subjectNum));
else
number = int2str(subjectNum);
end
ROOT_DIR = strcat('J:\Roliroli\S', number, '\');
TEST_CASE_FILE = strcat(ROOT_DIR,'autoSVMBuild.xlsx');
[~, ~, TEST_CASE_LIST] = xlsread(TEST_CASE_FILE);
COMBINATION_TIME_DIR = strcat(ROOT_DIR, 'Cycle-Time\Combination-', int2str(Combination), '\');
OUT_DIR = strcat(ROOT_DIR, 'Walking-Speed\Combination-', int2str(Combination), '\');
mkdir(OUT_DIR);
OUT_Self = [];
OUT_100 = [];
OUT_120 = [];
OUT_All = [];
for i = 1 : 30
svrTimes = load(strcat(COMBINATION_TIME_DIR, 'SVRTime-', int2str(i), '.txt'));
MVN_FILE_NAME = TEST_CASE_LIST{i, 1};
GAITRITE_FILE_NAME = TEST_CASE_LIST{i, 2};
START_TIME = TEST_CASE_LIST{i, 3};
load(MVN_FILE_NAME);
if(length(svrTimes) >= 5)
END_TIME = svrTimes(5);
leftP = gait.position(START_TIME:END_TIME, 64);
rightP = gait.position(START_TIME:END_TIME, 52);
if(leftP(end) > rightP(end))
vector = leftP;
else
vector = rightP;
end
s = vector(1);
e = vector(end);
speed = abs(e - s) / ((END_TIME - START_TIME + 1) * 0.008);
%OUT = [OUT ; speed];
else
speed = -1;
%OUT = [OUT ; -1];
end
if(~isempty(strfind(GAITRITE_FILE_NAME, 'Self')))
OUT_Self = [OUT_Self; speed];
elseif(~isempty(strfind(GAITRITE_FILE_NAME, '100')))
OUT_100 = [OUT_100; speed];
elseif(~isempty(strfind(GAITRITE_FILE_NAME, '120')))
OUT_120 = [OUT_120; speed];
end
OUT_All = [OUT_All ; speed];
end
dlmwrite(strcat(OUT_DIR, 'WalkingSpeed-Self.txt'), OUT_Self);
dlmwrite(strcat(OUT_DIR, 'WalkingSpeed-100.txt'), OUT_100);
dlmwrite(strcat(OUT_DIR, 'WalkingSpeed-120.txt'), OUT_120);
dlmwrite(strcat(OUT_DIR, 'WalkingSpeed-All.txt'), OUT_All);
end