Mercurial > hg > ltpda
comparison m-toolbox/classes/@LTPDAworkbench/plotHistory.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 % PLOTHISTORY plot the history of the currently selected blocks. | |
2 % | |
3 % CALL: wb.plot | |
4 % | |
5 % M Hewitson 13-11-08 | |
6 % | |
7 % $Id: plotHistory.m,v 1.9 2010/08/06 19:10:49 ingo Exp $ | |
8 % | |
9 function plotHistory(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 % dotview | |
36 | |
37 try | |
38 successes = 0; | |
39 for kk=1:numel(outvars) | |
40 | |
41 if evalin('base', ['isa(' outvars{kk} ', ''ltpda_uoh'')']) | |
42 | |
43 cmd = [outvars{kk} '.viewHistory()']; | |
44 try | |
45 evalin('base', cmd); | |
46 catch err | |
47 utils.helper.err(err.message); | |
48 cmd = ['plot(' outvars{kk} '.hist)']; | |
49 evalin('base', cmd); | |
50 end | |
51 successes = successes + 1; | |
52 else | |
53 cl = evalin('base', ['class(' outvars{kk} ')']); | |
54 warning('Skipping selected variable %s; it is not an LTPDA User Object with history. It is of class [%s].', outvars{kk}, cl); | |
55 end | |
56 end | |
57 catch | |
58 utils.helper.errorDlg('Unable to plot history of selected objects. Has the pipeline been executed or do you have more than one object?', 'Plot history error'); | |
59 end | |
60 | |
61 if successes ~= numel(outvars) | |
62 utils.helper.warnDlg('Not all outputs were processed. Check the MATLAB terminal for further warnings.', 'Plot history warning'); | |
63 end | |
64 end | |
65 |