comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_server_get_times.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function tss = ltpdv_server_get_times(mainfig)
2
3
4 % Do we have a list?
5 lh = findobj(mainfig, 'Tag', 'LTPDVtimesList');
6 tlist = getappdata(mainfig, 'TimesList');
7
8 if isempty(tlist)
9
10 % Get a single time from the entry boxes
11 start = ltpdv_server_get_start_time(mainfig);
12 stop = ltpdv_server_get_stop_time(mainfig);
13
14 if start < 0 || stop < 0
15 error('### Please set a start and stop time or add some times to the list.');
16 end
17
18 % Get comment
19 comm = ltpdv_server_get_comment(mainfig);
20
21 % Make a timespan object
22 tss = timespan(plist('start', GPS2UTC(start), 'end', GPS2UTC(stop)));
23 if ~isempty(comm)
24 tss.setName(comm);
25 end
26
27 else
28
29 % build a vector of timespan objects
30 tss = [];
31 for j=1:size(tlist,1)
32 t = tlist(j,:);
33 ts = timespan(plist('start', GPS2UTC(t{1}), 'end', GPS2UTC(t{2})));
34 if isempty(t{3})
35 ts.setName('None');
36 else
37 ts.setName(t{3});
38 end
39 tss = [tss ts];
40 end
41
42
43 end