forked from januhlenberg/Signa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassSearch.m
46 lines (35 loc) · 1.19 KB
/
ClassSearch.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
files = getAllFiles('C:\Users\Jan\Desktop\Training\CarImages\');
load('Trainingsdaten.mat');
timedifference = 7.886;
fileCount = length(files);
carTimes = []
for j=1:size(Datentrain,1)
carTimes = [carTimes datetime("25-Jun-2017 " + string(Datentrain{j,3}), 'InputFormat','dd-MM-yyyy HH:mm:ss.SSS') + seconds(timedifference)];
end
carClasses = [];
for i=1:fileCount
path = fullfile(char(files(i)));
hour = path(end-17:end-16);
minute = path(end-14:end-13);
second = path(end-11:end-10);
millisecond = path(end-8:end-6);
track = str2double(path(end-4:end-4))-1;
t = datetime("25-Jun-2017 " + hour + ":" + minute + ":" +second + "." + millisecond, 'InputFormat','dd-MM-yyyy HH:mm:ss.SSS');
% find data index
ti = 0;
minTime = 10000000;
for j=1:size(Datentrain,1)
tableTime = carTimes(j);
if abs(t - tableTime) < minTime && track == double(Datentrain{j,4})
minTime = t - tableTime;
ti = j;
end
end
% d = abs(milliseconds(t - carTimes(ti)));
% if(d > 1500)
% ti
% end
%}
carClasses = [carClasses double(Datentrain{ti,5})];
end
save('classesForIndex.mat','carClasses')