-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassifier.m
35 lines (28 loc) · 1.1 KB
/
Classifier.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
function Classifier(record)
t=cputime();
annotationsFileName = sprintf("%s.txt", record);
[beats, count] = readannotationsMITBIH(annotationsFileName);
Fs = 360; % 250 for LTST, 360 for MIT-BIH
% classificatior using 1. strategy for initial threshold
% classifications = QRSClassify1(record, beats, Fs);
% classificatior using 2. strategy for initial threshold
classifications = QRSClassify2(record, beats, Fs);
fprintf('Running time: %f\n', cputime() - t);
if isnan(classifications)
fprintf("Skip this record %s\n", record);
end
asciName = sprintf('%s.cls',record);
fid = fopen(asciName, 'wt');
for i=1:size(beats,1)
if isnan(classifications)
% don't use this record for comparison because no normal beat
% in learning process
fprintf(fid,'0:00:00.00 %d X 0 0 0\n', beats(i,1));
elseif classifications(i) == 0
fprintf(fid,'0:00:00.00 %d N 0 0 0\n', beats(i,1));
else
fprintf(fid,'0:00:00.00 %d V 0 0 0\n', beats(i,1));
end
end
fclose(fid);
end