Mercurial > hg > ltpda
comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_search_channels.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 ltpdv_search_channels(varargin) | |
2 | |
3 % LTPDV_SEARCH_CHANNELS search the channel list and reduce it to those that | |
4 % match the search criteria. | |
5 % | |
6 % M Hewitson 26-07-06 | |
7 % | |
8 % $Id: ltpdv_search_channels.m,v 1.1 2008/05/11 10:38:43 hewitson Exp $ | |
9 | |
10 % Handles | |
11 myh = varargin{1}; | |
12 mainfig = varargin{end}; | |
13 | |
14 % channels | |
15 ch = findobj(mainfig, 'Tag', 'LTPDVchannelList'); | |
16 chans = get(ch, 'String'); | |
17 | |
18 nchans = size(chans,1); | |
19 chansout = []; | |
20 | |
21 % First tokenize the search string | |
22 sh = findobj(mainfig, 'Tag', 'LTPDVchannelSearchEdit'); | |
23 sstr = get(sh, 'String'); | |
24 curr = upper(sstr); | |
25 if isempty(curr) | |
26 [latest, chans] = ltpdv_server_get_latest_chans(mainfig); | |
27 % Set channel list | |
28 ltpdv_server_set_channel_list(mainfig, chans); | |
29 else | |
30 | |
31 [t, r] = strtok(curr); | |
32 cstr = []; | |
33 cstr = [cstr; cellstr(t)]; | |
34 while ~isempty(r) | |
35 [t, r] = strtok(r); | |
36 cstr = [cstr; cellstr(t)]; | |
37 end | |
38 | |
39 if strcmp(curr, '') | |
40 chansout = chans; | |
41 else | |
42 for str=1:length(cstr) | |
43 for c=1:nchans | |
44 idx = strfind(upper(chans(c,:)), char(cstr(str))); | |
45 if ~isempty(idx) | |
46 chansout = strvcat(chansout, deblank(chans(c,:))); | |
47 end | |
48 end | |
49 end | |
50 end | |
51 | |
52 if ~isempty(chansout) | |
53 chansout = char(sort(cellstr(chansout))); | |
54 end | |
55 | |
56 ltpdv_server_set_channel_list(mainfig, chansout); | |
57 | |
58 end | |
59 | |
60 | |
61 % END |