-
Notifications
You must be signed in to change notification settings - Fork 2
/
sortann.m
executable file
·82 lines (77 loc) · 2.14 KB
/
sortann.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
78
79
80
81
82
function varargout=sortann(varargin)
%
% sortann(recName,annName,beginTime,stopTime,outFile)
%
% Wrapper to WFDB SORTANN:
% http://www.physionet.org/physiotools/wag/sortan-1.htm
%
% Rewrites the annotation file specified by recName and annName, arranging its contents in
% canonical (time, num, and chan) order. The sorted (output) annotation file is always written
% to the current directory. If the input annotation file is in the current directory, SORTANN
% replaces it unless you specify a different output annotator name (using the outFile option).
% If the input annotations are already in the correct order, no output is written unless you
% have used the outFile option.
%
%
%Input Parameters:
% recName
% String specifying the WFDB record file.
%
% annName
% String specifying the reference WFDB annotation file.
%
% stopTime (Optional)
% String specifying the start time in WFDB format (default is beginning of
% record).
%
% stopTime (Optional)
% String specifying the stop time in WFDB format (default is end of
% record).
%
% outFile (Optional)
% String specifying the output annotation file name.
%
%
% Written by Ikaro Silva, 2013
% Last Modified: -
% Version 1.0
% Since 0.9.0
%
% %Example (this will generate a /mitdb/100.sortedATR file at your directory):
%
% sortann('mitdb/100','atr',[],[],'sortedATR');
% ann=rdann('mitdb/100','sortedATR');
%
%
% See also RDANN
%endOfHelp
persistent javaWfdbExec
if(isempty(javaWfdbExec))
javaWfdbExec=getWfdbClass('sortann');
end
%Set default pararamter values
inputs={'recName','annName','beginTime','stopTime','outFile'};
recName=[];
annName=[];
beginTime=[];
stopTime=[];
outFile=[];
for n=1:nargin
if(~isempty(varargin{n}))
eval([inputs{n} '=varargin{n};'])
end
end
wfdb_argument={'-r',recName,'-a',annName};
if(~isempty(beginTime))
wfdb_argument{end+1}='-f';
wfdb_argument{end+1}=beginTime;
end
if(~isempty(stopTime))
wfdb_argument{end+1}='-t';
wfdb_argument{end+1}=stopTime;
end
if(~isempty(outFile))
wfdb_argument{end+1}='-o';
wfdb_argument{end+1}=outFile;
end
javaWfdbExec.execToStringList(wfdb_argument);