Home > m > gui > ltpdv > callbacks > ltpdv_fcn_run.m

ltpdv_fcn_run

PURPOSE ^

LTPDV_FCN_RUN runs the command on the selected panel

SYNOPSIS ^

function ltpdv_fcn_run(varargin)

DESCRIPTION ^

 LTPDV_FCN_RUN runs the command on the selected panel

 M Hewitson 23-04-08

 $Id: ltpdv_fcn_run.m,v 1.3 2008/09/02 07:51:47 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ltpdv_fcn_run(varargin)
0002   % LTPDV_FCN_RUN runs the command on the selected panel
0003   %
0004   % M Hewitson 23-04-08
0005   %
0006   % $Id: ltpdv_fcn_run.m,v 1.3 2008/09/02 07:51:47 hewitson Exp $
0007   %
0008 
0009   % Get handles
0010   myh     = varargin{1};
0011   tag     = varargin{end-2};
0012   panH    = varargin{end-1};
0013   mainfig = varargin{end};
0014 
0015   % Get function
0016   switch tag
0017     case 'preproc'
0018       listtag = 'LTPDVpreprocfcnlist';
0019       ptag    = 'LTPDVpreprocparampan';
0020     case 'spectral'
0021       listtag = 'LTPDVspectralfcnlist';
0022       ptag    = 'LTPDVspectralparampan';
0023     otherwise
0024       error('### Unknown function set');
0025   end
0026   fcnh = findobj(panH, 'Tag', listtag);
0027   val  = get(fcnh, 'Value');
0028   strs = get(fcnh, 'String');
0029   fcn  = strs{val};
0030 
0031   % Get params
0032   parampanh = findobj(panH, 'Tag', ptag);
0033   pl = ltpdv_get_params_from_panel(parampanh);
0034 
0035   % Get selected objects
0036   objs = ltpdv_get_selected_objs(mainfig);
0037 
0038   % Collect AOs
0039   as = [];
0040   for j=1:numel(objs)
0041     obj = objs{j};
0042     if isa(obj, 'ao')
0043       as = [as obj];
0044     else
0045       warning('!!! Skipping object %s - it''s not an AO', obj.name);
0046     end
0047   end
0048 
0049   % Evaluate fcn
0050   res = feval(fcn, as, pl);
0051 
0052   % Add result to object list
0053   for j=1:numel(res)
0054     objs = getappdata(mainfig, 'LTPDAobjects');
0055     setappdata(mainfig, 'LTPDAobjects', [objs {res(j)}]);
0056   end
0057   % Refresh object list
0058   ltpdv_refresh_object_list(mainfig);
0059 
0060 end
0061 
0062   % END

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003