comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_parse_control_chans.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 control_channels = dv_parse_control_chans(channels)
2
3 % DV_PARSECONTROLCHANS parse out a list of control channels from the input
4 % channel list.
5 %
6 % Usage: control_channels = dv_parsecontrolchans(chanlist);
7 %
8 % Input form:
9 %
10 % channel = "top_level#sub_level_1#N#ch1#...#chN#sub_level_2#..."
11 %
12 % Output form:
13 %
14 % channels(1) = "top_level:sub_level_1:ch1"
15 % channels(2) = "top_level:sub_level_1:ch2"
16 % :
17 % :
18 %
19 %
20 % M Hewitson 26-07-06
21 %
22 % $Id: ltpdv_parse_control_chans.m,v 1.1 2008/05/11 10:38:43 hewitson Exp $
23
24
25 % control data is sampled at 1Hz for now
26 count = 1;
27
28 numtoplevels = length(channels(:,1));
29
30 ch = 1;
31 control_channels = [];
32 for top=1:numtoplevels
33
34 name = channels(top,:);
35 if(length(name)>40)
36
37 % parse the input string
38 % get first part as top level
39 [toplevel, r] = strtok(name, '#');
40 name = r;
41 while(length(name) > 1)
42
43 % get sub level
44 [sublevel, r] = strtok(name, '#');
45 name = deblank(r);
46
47 % get the number of sub sub levels
48 [strN, r] = strtok(name, '#');
49 name = deblank(r);
50 % convert strN
51 N = eval(strN);
52 % now get each sub sub level making channel
53 % names as we go and extracting data as we go
54 for s = 1:N
55 [subsublevel, r] = strtok(name, '#');
56 name = deblank(r);
57 control_channels = strvcat(control_channels,[toplevel ':' sublevel ':' subsublevel ]);
58 ch = ch + 1;
59 end
60 end
61 end
62 end
63
64 ch = ch-1;
65
66
67
68 % END
69