Mercurial > hg > ltpda
comparison m-toolbox/classes/@LTPDAworkbench/plot.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 % PLOT plot the outputs of the currently selected blocks. | |
2 % | |
3 % CALL: wb.plot | |
4 % | |
5 % M Hewitson 13-11-08 | |
6 % | |
7 % $Id: plot.m,v 1.8 2010/08/06 19:10:49 ingo Exp $ | |
8 % | |
9 function plot(varargin) | |
10 | |
11 wb = varargin{1}; | |
12 | |
13 % Get all selected blocks | |
14 sbs = awtinvoke(wb.mp, 'getSelectedBlocks'); | |
15 | |
16 outvars = {}; | |
17 for ii=0:sbs.size()-1 | |
18 block = sbs.get(ii); | |
19 | |
20 % if this is a MElementWithPorts | |
21 if isa(block, 'mpipeline.canvas.MElementWithPorts') | |
22 | |
23 % loop over all outputs | |
24 outports = block.getOutputs(); | |
25 for kk=0:outports.size()-1 | |
26 op = outports.get(kk); | |
27 % get variable name | |
28 outvar = LTPDAworkbench.getWS_VarName(wb.UUID, block, op.getNumber); | |
29 outvars = [outvars {outvar}]; | |
30 end | |
31 end | |
32 end | |
33 | |
34 % Check if each var exists in the workspace, and then launch in | |
35 % ltpda_explorer | |
36 | |
37 if ~isempty(outvars) | |
38 | |
39 cmd = 'iplot('; | |
40 for kk=1:numel(outvars) | |
41 | |
42 % Check if the user have execute the pipeline. | |
43 if (evalin('base', ['exist(''' strtok(outvars{kk}, '.') ''')']) ~= 1) || ... | |
44 isempty(evalin('base', strtok(outvars{kk}, '.'))) | |
45 utils.helper.errorDlg('Unable to plot selected objects. Has the pipeline been executed?', 'Plot block outputs error'); | |
46 return | |
47 end | |
48 | |
49 if isa(evalin('base', outvars{kk}), 'ao') | |
50 cmd = [cmd outvars{kk} ',']; | |
51 else | |
52 utils.helper.errorDlg(sprintf('Please select only analysis objects (AOs) because you selected a %s object.', class(evalin('base', outvars{kk}))), 'Plot block outputs error'); | |
53 return | |
54 end | |
55 end | |
56 | |
57 if cmd(end)==',' | |
58 cmd = cmd(1:end-1); | |
59 end | |
60 cmd = [cmd ')']; | |
61 try | |
62 evalin('base', cmd); | |
63 catch | |
64 utils.helper.errorDlg('Unable to plot selected objects. Has the pipeline been executed?', 'Plot block outputs error'); | |
65 end | |
66 end | |
67 | |
68 end | |
69 |