view m-toolbox/classes/@LTPDAworkbench/cb_display.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents f0afece42f48
children
line wrap: on
line source

% CB_DISPLAY displays the outputs of the currently selected blocks
%
% CALL: LTPDAworkbench.cb_display
%
% M Hewitson 13-11-08
%
% $Id: cb_display.m,v 1.5 2010/08/06 19:10:48 ingo Exp $
%
function cb_display(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 display
  
  try
    for kk=1:numel(outvars)
      evalin('base', outvars{kk});
    end
  catch
    utils.helper.errorDlg('Unable to display selected objects. Has the pipeline been executed?', 'Display block outputs error');
  end
  
end