Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/table.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 % TABLE display the data from the AO in a table. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: TABLE display the data from the AO in a table. | |
5 % | |
6 % CALL: table(ao) | |
7 % | |
8 % NOTE: this does not support xyzdata objects. | |
9 % | |
10 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'table')">Parameters Description</a> | |
11 % | |
12 % VERSION: $Id: table.m,v 1.12 2011/04/08 08:56:18 hewitson Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function varargout = table(varargin) | |
17 | |
18 % Check if this is a call for parameters | |
19 if utils.helper.isinfocall(varargin{:}) | |
20 varargout{1} = getInfo(varargin{3}); | |
21 return | |
22 end | |
23 | |
24 import utils.const.* | |
25 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
26 | |
27 % Collect all AOs | |
28 as = utils.helper.collect_objects(varargin(:), 'ao'); | |
29 pl = utils.helper.collect_objects(varargin(:), 'plist'); | |
30 | |
31 pl = combine(pl, getDefaultPlist()); | |
32 | |
33 singleTable = pl.find('singleTable'); | |
34 | |
35 x = java.util.ArrayList(); | |
36 y = java.util.ArrayList(); | |
37 xt = java.util.ArrayList(); | |
38 yt = java.util.ArrayList(); | |
39 | |
40 % Loop over AOs | |
41 for jj = 1:numel(as) | |
42 | |
43 if isa(as(jj).data, 'xyzdata') | |
44 % The table doesn'T work for xyzdata | |
45 error('### The table doesn''t work for AOs with xyz-data'); | |
46 elseif isa(as(jj).data, 'cdata') | |
47 for kk = 1:size(as(jj).y, 2) | |
48 data = as(jj).y; | |
49 y.add(data(:,kk)); | |
50 x.add([]); | |
51 yt.add('const'); | |
52 xt.add([]); | |
53 end | |
54 else | |
55 x.add(as(jj).x); | |
56 y.add(as(jj).y); | |
57 xt.add(['x ' char(as(jj).xunits)]); | |
58 yt.add(['y ' char(as(jj).yunits)]); | |
59 end | |
60 | |
61 if ~singleTable | |
62 d = datatable.TableForm(x,y,xt,yt); | |
63 d.setVisible(true); | |
64 d.setTitle(as(jj).name); | |
65 x.clear(); | |
66 y.clear(); | |
67 xt.clear(); | |
68 yt.clear(); | |
69 end | |
70 end | |
71 if singleTable | |
72 d = datatable.TableForm(x,y,xt,yt); | |
73 d.setVisible(true); | |
74 end | |
75 end | |
76 | |
77 %-------------------------------------------------------------------------- | |
78 % Get Info Object | |
79 %-------------------------------------------------------------------------- | |
80 function ii = getInfo(varargin) | |
81 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
82 sets = {}; | |
83 pl = []; | |
84 else | |
85 sets = {'Default'}; | |
86 pl = getDefaultPlist; | |
87 end | |
88 % Build info object | |
89 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.output, '$Id: table.m,v 1.12 2011/04/08 08:56:18 hewitson Exp $', sets, pl); | |
90 ii.setModifier(false); | |
91 ii.setOutmin(0); | |
92 end | |
93 | |
94 %-------------------------------------------------------------------------- | |
95 % Get Default Plist | |
96 %-------------------------------------------------------------------------- | |
97 function plout = getDefaultPlist() | |
98 persistent pl; | |
99 if exist('pl', 'var')==0 || isempty(pl) | |
100 pl = buildplist(); | |
101 end | |
102 plout = pl; | |
103 end | |
104 | |
105 function pl = buildplist() | |
106 pl = plist(); | |
107 | |
108 p = param({'singleTable','Display the AOs in a single talbe.'}, paramValue.TRUE_FALSE); | |
109 pl.append(p); | |
110 | |
111 end | |
112 | |
113 |