Mercurial > hg > ltpda
view m-toolbox/classes/@LTPDAworkbench/plotHistory.m @ 38:3aef676a1b20 database-connection-manager
Keep backtrace on error
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% PLOTHISTORY plot the history of the currently selected blocks. % % CALL: wb.plot % % M Hewitson 13-11-08 % % $Id: plotHistory.m,v 1.9 2010/08/06 19:10:49 ingo Exp $ % function plotHistory(varargin) wb = varargin{1}; % Get all selected blocks sbs = awtinvoke(wb.mp, 'getSelectedBlocks'); outvars = {}; for ii=0:sbs.size()-1 block = sbs.get(ii); % if this is a MElementWithPorts if isa(block, 'mpipeline.canvas.MElementWithPorts') % loop over all outputs outports = block.getOutputs(); for kk=0:outports.size()-1 op = outports.get(kk); % get variable name outvar = LTPDAworkbench.getWS_VarName(wb.UUID, block, op.getNumber); outvars = [outvars {outvar}]; end end end % Check if each var exists in the workspace, and then launch in % dotview try successes = 0; for kk=1:numel(outvars) if evalin('base', ['isa(' outvars{kk} ', ''ltpda_uoh'')']) cmd = [outvars{kk} '.viewHistory()']; try evalin('base', cmd); catch err utils.helper.err(err.message); cmd = ['plot(' outvars{kk} '.hist)']; evalin('base', cmd); end successes = successes + 1; else cl = evalin('base', ['class(' outvars{kk} ')']); warning('Skipping selected variable %s; it is not an LTPDA User Object with history. It is of class [%s].', outvars{kk}, cl); end end catch 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'); end if successes ~= numel(outvars) utils.helper.warnDlg('Not all outputs were processed. Check the MATLAB terminal for further warnings.', 'Plot history warning'); end end