comparison m-toolbox/m/gui/ltpdv/callbacks/ltpdv_fcn_run.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_fcn_run(varargin)
2 % LTPDV_FCN_RUN runs the command on the selected panel
3 %
4 % M Hewitson 23-04-08
5 %
6 % $Id: ltpdv_fcn_run.m,v 1.4 2008/09/08 12:31:43 hewitson Exp $
7 %
8
9 % Get handles
10 myh = varargin{1};
11 tag = varargin{end-2};
12 panH = varargin{end-1};
13 mainfig = varargin{end};
14
15 % Get function
16 switch tag
17 case 'preproc'
18 listtag = 'LTPDVpreprocfcnlist';
19 ptag = 'LTPDVpreprocparampan';
20 fcns = ltpdv_preproc_function_list;
21 case 'spectral'
22 listtag = 'LTPDVspectralfcnlist';
23 ptag = 'LTPDVspectralparampan';
24 fcns = ltpdv_spectral_function_list;
25 otherwise
26 error('### Unknown function set');
27 end
28 fcnh = findobj(panH, 'Tag', listtag);
29 val = get(fcnh, 'Value');
30 strs = get(fcnh, 'String');
31 fcn = strs{val};
32
33 idx = strcmp(fcn, fcns);
34 idx = find(idx(:,2));
35 fcn = fcns{idx,1};
36
37 % Get params
38 parampanh = findobj(panH, 'Tag', ptag);
39 pl = ltpdv_get_params_from_panel(parampanh);
40
41 % Get selected objects
42 objs = ltpdv_get_selected_objs(mainfig);
43
44 % Collect AOs
45 as = [];
46 for j=1:numel(objs)
47 obj = objs{j};
48 if isa(obj, 'ao')
49 as = [as obj];
50 else
51 warning('!!! Skipping object %s - it''s not an AO', obj.name);
52 end
53 end
54
55 % Evaluate fcn
56 res = feval(fcn, as, pl);
57
58 % Add result to object list
59 for j=1:numel(res)
60 objs = getappdata(mainfig, 'LTPDAobjects');
61 setappdata(mainfig, 'LTPDAobjects', [objs {res(j)}]);
62 end
63 % Refresh object list
64 ltpdv_refresh_object_list(mainfig);
65
66 end
67
68 % END