Mercurial > hg > ltpda
diff m-toolbox/test/gui/functions/gltpda_analyse.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/test/gui/functions/gltpda_analyse.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,76 @@ +function gltpda_analyse(handles) + +% GLTPDA_ANALYSE perform the selected analysis on the selected analysis +% objects. +% +% M Hewitson 15-02-07 +% +% $Id: gltpda_analyse.m,v 1.2 2007/03/23 06:47:24 hewitson Exp $ +% + +%% Get selected AOs +% get AO array +aos = getappdata(handles.main, 'aos'); + +% Get selected objects +selected = get(handles.aoList, 'Value'); +a = aos.objs(selected); + +%% Analyse these + +% get selected analysis name +aname = get(handles.analysisList, 'String'); +aidx = get(handles.analysisList, 'Value'); +analysis = aname(aidx); + +% get the function structure for this +settings = getappdata(handles.main, 'settings'); +fcn = []; +for j=1:length(settings.functions) + if strcmp(settings.functions(j).call, analysis) + fcn = settings.functions(j); + end +end +if isempty(fcn) + error('### function not found in function list.'); +end + +% form parameter string +pl = plist(); +% append non-default parameters +for j=1:length(fcn.params) + p = fcn.params(j); + if ~isempty(p.val) + pstr = ['pl = append(pl, param(' char(p.name) ',']; + if isnumeric(p.val) + pstr = [pstr num2str(p.val) ')']; + elseif ischar(p.val) + pstr = [pstr p.val ')']; + elseif isa(p.val, 'specwin') + pstr = [pstr 'p.val' ')']; + else + end + pstr = [pstr ');']; + end +end + +% Form an evaluation string +estr = ['b = ' fcn.call fcn.inputs ';'] +eval(estr); + +%% Add new ao to list + +% Add to object array +aos.objs = [aos.objs b]; +aos.nobjs = aos.nobjs + length(b); + +% Set array +setappdata(handles.main, 'aos', aos); + +% Update object list +gltpda_setAOlist(handles); + + + + +% END \ No newline at end of file