-
Notifications
You must be signed in to change notification settings - Fork 0
/
createFeatureMatrix2_Continuous.m
77 lines (61 loc) · 2.89 KB
/
createFeatureMatrix2_Continuous.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
function [feature_matrix] = createFeatureMatrix2_Continuous(strideList, strideListOther, prediction_signals,two_feet, WINDOW_SIZE, cnn)
nOutputSignals = numel(prediction_signals)*(two_feet+1);
lenStrideList = numel(strideList.(prediction_signals{1}));
means = zeros(lenStrideList- WINDOW_SIZE, numel(prediction_signals)*(two_feet+1));
maxs = means;
mins = means;
ranges = means;
jrange = 1:(two_feet+1):nOutputSignals;
start = 1;
% if lenStrideList == WINDOW_SIZE
% lenStrideList = lenStrideList+1;
% end
for i=1:lenStrideList-WINDOW_SIZE
window_start = i; window_end = i + WINDOW_SIZE -1;
iter = 1;
% lsend = start + length(strideList(i).(prediction_signals{1}));
% start = lsend(end);
lone_iter = 1;
delj = [];
for jj=1:length(jrange)
j = jrange(jj);
cycle_time = length(strideList.(prediction_signals{iter}));
% strideList.(prediction_signals{iter}) = strideList.(prediction_signals{iter})(cycle_time*WINDOW_START:cycle_time*WINDOW_END);
if cnn~=0
data{i}(:,j,1) = strideList.(prediction_signals{iter})(window_start:window_end);
% data(:,j,1,i) = strideList.(prediction_signals{iter})(window_start:window_end);
end
means(i,j) = mean(strideList.(prediction_signals{iter})(window_start:window_end));
maxs(i,j) = max(strideList.(prediction_signals{iter})(window_start:window_end));
mins(i,j) = min(strideList.(prediction_signals{iter})(window_start:window_end));
ranges(i,j) = range(strideList.(prediction_signals{iter})(window_start:window_end));
if two_feet
% strideListOther.(prediction_signals{iter}) = strideListOther.(prediction_signals{iter})(cycle_time*WINDOW_START:cycle_time*WINDOW_END);
if cnn
data{i}(:,j+1,1) = strideListOther.(prediction_signals{iter})(window_start:window_end);
% data(:,j+1,1,i) = strideListOther.(prediction_signals{iter})(window_start:window_end);
end
means(i,j+1) = mean(strideListOther.(prediction_signals{iter})(window_start:window_end));
maxs(i,j+1) = max(strideListOther.(prediction_signals{iter})(window_start:window_end));
mins(i,j+1) = min(strideListOther.(prediction_signals{iter})(window_start:window_end));
ranges(i,j+1) = range(strideListOther.(prediction_signals{iter})(window_start:window_end));
end
iter = iter+1;
end
end
% maxs(:,delj)=[]; mins(:,delj) = []; ranges(:,delj) = [];
if cnn
feature_matrix = data;
else
feature_matrix = [maxs, mins, ranges];
end
% feature_matrix = [maxs(:,1:end-size(lone_sig,2)), mins(:,1:end-size(lone_sig,2)), ...
% ranges(:,1:end-size(lone_sig,2)), lone_sig];
% if size(feature_matrix,2)>30
% x = 'debug';
% end
% rperm = randperm(lenStrideList);
% randomized_feature_matrix = feature_matrix(rperm,:);
%
% labels_in = lab_foot(rperm);
end