comparison m-toolbox/classes/@LTPDAworkbench/cb_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 % CB_TABLE show the outputs of the currently selected blocks in a table.
2 %
3 % CALL: LTPDAworkbench.cb_table
4 %
5 % M Hewitson 13-11-08
6 %
7 % $Id: cb_table.m,v 1.4 2010/08/06 19:10:49 ingo Exp $
8 %
9 function cb_table(varargin)
10
11 wb = varargin{1};
12
13 % Get all selected blocks
14 sbs = awtinvoke(wb.mp, 'getSelectedBlocks');
15
16 failed = false;
17 skipped = 0;
18 for ii=0:sbs.size()-1
19 block = sbs.get(ii);
20
21 % if this is a MElementWithPorts
22 if isa(block, 'mpipeline.canvas.MElementWithPorts')
23
24 % loop over all outputs
25 outports = block.getOutputs();
26 for kk=0:outports.size()-1
27 op = outports.get(kk);
28 % get variable name
29 outvar = LTPDAworkbench.getWS_VarName(wb.UUID, block, op.getNumber);
30
31 % Check if the user have execute the pipeline.
32 if (evalin('base', ['exist(''' strtok(outvar, '.') ''')']) ~= 1) || ...
33 isempty(evalin('base', strtok(outvar, '.')))
34 utils.helper.errorDlg('Failed to show one or more of the selected objects in tables. Has the pipeline been executed?', 'Table block outputs error');
35 return
36 end
37
38 if evalin('base', ['isa(' outvar ', ''ao'')'])
39 try
40 cmd = ['table(' outvar ')'];
41 evalin('base', cmd);
42 catch
43 failed = true;
44 end
45 else
46 warning('!!! Skipping block output [%s] since it''s not an AO', outvar);
47 skipped = skipped + 1;
48 end
49 end
50 end
51 end
52
53 if failed
54 utils.helper.errorDlg('Failed to show one or more of the selected objects in tables. Has the pipeline been executed?', 'Table block outputs error');
55 end
56
57 if skipped > 0
58 utils.helper.warnDlg('Not all selected blocks could be tabulated. Check the MATLAB terminal for further warnings.');
59 end
60
61 end
62