-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindclean.m
More file actions
115 lines (100 loc) · 2.06 KB
/
findclean.m
File metadata and controls
115 lines (100 loc) · 2.06 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
% function [ leftpos,rightpos ] = findclean( rec_path )
% %UNTITLED2 此处显示有关此函数的摘要
% % 此处显示详细说明
% ann=textread([rec_path 'ecgatrann.data'],'%f');
% atr=textread([rec_path 'ecgatr.data'],'%f');
%
% isFound=0;
% tempLeft=1;
% tempRight=1;
% startWithPos=1;
%
% while(1)
% if startWithPos >= length(ann)
% break;
% end
%
% for m1 = startWithPos:length(ann)
% if(ann(m1) ~= 14)
% tempLeft = m1;
% break;
% end
% end
%
% if m1 >= length(ann)
% break;
% end
%
% for m2=m1+1:length(ann)
% if(ann(m2) == 14)
% tempRight = m2-1;
% break;
% end
%
% if m2 == length(ann)
% tempRight = m2;
% end
% end
%
% if atr(tempRight) - atr(tempLeft) > 5120
% isFound =1;
% break;
% end
%
% startWithPos = m2 + 1;
%
%
% end
%
% if isFound==1
% leftpos = atr(tempLeft);
% rightpos = atr(tempRight);
% else
% leftpos = 0;
% rightpos = 0;
% end
%
% end
function [ leftpos,rightpos ] = findclean( rec_path )
%UNTITLED2 此处显示有关此函数的摘要
% 此处显示详细说明
ann=textread([rec_path 'ecgatrann.data'],'%f');
atr=textread([rec_path 'ecgatr.data'],'%f');
isFound=0;
tempLeft=1;
tempRight=1;
startWithPos=1;
while(1)
if startWithPos >= length(ann)
break;
end
for m1=startWithPos:length(ann)
if(ann(m1) ~= 14)
tempLeft = m1;
break;
end
end
if m1 >= length(ann)
break;
end
for m2=m1+1:length(ann)
if(ann(m2) == 14)
tempRight = m2-1;
break;
end
if m2 == length(ann)
tempRight = m2;
end
end
if atr(tempRight) - atr(tempLeft) > 5120
isFound = isFound+1;
leftpos(isFound) = atr(tempLeft);
rightpos(isFound) = atr(tempRight);
end
startWithPos = m2+1;
end
if isFound==0
leftpos(1) = 0;
rightpos(1) = 0;
end
end