-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtgGetStartTime.m
More file actions
42 lines (38 loc) · 899 Bytes
/
Copy pathtgGetStartTime.m
File metadata and controls
42 lines (38 loc) · 899 Bytes
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
function t = tgGetStartTime(tg, tierInd)
% function t = tgGetStartTime(tg, tierInd)
%
% Returns start time. If tier index is specified, it returns start time
% of the tier, if it is not specified, it returns start time of the whole
% TextGrid.
%
% tierInd ... [optional] tier index or 'name'
%
% v1.0, Tomas Boril, borilt@gmail.com
%
% Example
% tg = tgRead('demo/H.TextGrid');
% tgGetStartTime(tg)
% tgGetStartTime(tg, 'phone')
if nargin == 1
t = tg.tmin;
return;
end
if nargin ~= 2
error('Wrong number of arguments.')
end
tierInd = tgI(tg, tierInd);
if tgIsPointTier(tg, tierInd)
if length(tg.tier{tierInd}.T) < 1
t = NaN;
else
t = tg.tier{tierInd}.T(1);
end
elseif tgIsIntervalTier(tg, tierInd)
if length(tg.tier{tierInd}.T1) < 1
t = NaN;
else
t = tg.tier{tierInd}.T1(1);
end
else
error('unknown tier type')
end