Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/ltpdv/callbacks/ltpdv_fcn_run.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,68 @@ +function ltpdv_fcn_run(varargin) + % LTPDV_FCN_RUN runs the command on the selected panel + % + % M Hewitson 23-04-08 + % + % $Id: ltpdv_fcn_run.m,v 1.4 2008/09/08 12:31:43 hewitson Exp $ + % + + % Get handles + myh = varargin{1}; + tag = varargin{end-2}; + panH = varargin{end-1}; + mainfig = varargin{end}; + + % Get function + switch tag + case 'preproc' + listtag = 'LTPDVpreprocfcnlist'; + ptag = 'LTPDVpreprocparampan'; + fcns = ltpdv_preproc_function_list; + case 'spectral' + listtag = 'LTPDVspectralfcnlist'; + ptag = 'LTPDVspectralparampan'; + fcns = ltpdv_spectral_function_list; + otherwise + error('### Unknown function set'); + end + fcnh = findobj(panH, 'Tag', listtag); + val = get(fcnh, 'Value'); + strs = get(fcnh, 'String'); + fcn = strs{val}; + + idx = strcmp(fcn, fcns); + idx = find(idx(:,2)); + fcn = fcns{idx,1}; + + % Get params + parampanh = findobj(panH, 'Tag', ptag); + pl = ltpdv_get_params_from_panel(parampanh); + + % Get selected objects + objs = ltpdv_get_selected_objs(mainfig); + + % Collect AOs + as = []; + for j=1:numel(objs) + obj = objs{j}; + if isa(obj, 'ao') + as = [as obj]; + else + warning('!!! Skipping object %s - it''s not an AO', obj.name); + end + end + + % Evaluate fcn + res = feval(fcn, as, pl); + + % Add result to object list + for j=1:numel(res) + objs = getappdata(mainfig, 'LTPDAobjects'); + setappdata(mainfig, 'LTPDAobjects', [objs {res(j)}]); + end + % Refresh object list + ltpdv_refresh_object_list(mainfig); + +end + + % END \ No newline at end of file