comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function gltpda_analyse(handles)
2
3 % GLTPDA_ANALYSE perform the selected analysis on the selected analysis
4 % objects.
5 %
6 % M Hewitson 15-02-07
7 %
8 % $Id: gltpda_analyse.m,v 1.2 2007/03/23 06:47:24 hewitson Exp $
9 %
10
11 %% Get selected AOs
12 % get AO array
13 aos = getappdata(handles.main, 'aos');
14
15 % Get selected objects
16 selected = get(handles.aoList, 'Value');
17 a = aos.objs(selected);
18
19 %% Analyse these
20
21 % get selected analysis name
22 aname = get(handles.analysisList, 'String');
23 aidx = get(handles.analysisList, 'Value');
24 analysis = aname(aidx);
25
26 % get the function structure for this
27 settings = getappdata(handles.main, 'settings');
28 fcn = [];
29 for j=1:length(settings.functions)
30 if strcmp(settings.functions(j).call, analysis)
31 fcn = settings.functions(j);
32 end
33 end
34 if isempty(fcn)
35 error('### function not found in function list.');
36 end
37
38 % form parameter string
39 pl = plist();
40 % append non-default parameters
41 for j=1:length(fcn.params)
42 p = fcn.params(j);
43 if ~isempty(p.val)
44 pstr = ['pl = append(pl, param(' char(p.name) ','];
45 if isnumeric(p.val)
46 pstr = [pstr num2str(p.val) ')'];
47 elseif ischar(p.val)
48 pstr = [pstr p.val ')'];
49 elseif isa(p.val, 'specwin')
50 pstr = [pstr 'p.val' ')'];
51 else
52 end
53 pstr = [pstr ');'];
54 end
55 end
56
57 % Form an evaluation string
58 estr = ['b = ' fcn.call fcn.inputs ';']
59 eval(estr);
60
61 %% Add new ao to list
62
63 % Add to object array
64 aos.objs = [aos.objs b];
65 aos.nobjs = aos.nobjs + length(b);
66
67 % Set array
68 setappdata(handles.main, 'aos', aos);
69
70 % Update object list
71 gltpda_setAOlist(handles);
72
73
74
75
76 % END