view m-toolbox/classes/@LTPDAworkbench/clearBlockVariables.m @ 36:5eb86f6881ef database-connection-manager

Remove commented-out code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function clearBlockVariables(rbs)
  
  Nrbs = numel(rbs);
  % loop over blocks
  for jj=1:Nrbs
    block = rbs(jj);
    if isa(block, 'mpipeline.canvas.MElementWithPorts')
      % get the src block for each input
      inputs = block.getInputs();
      % Loop over the inputs to get the variable names of the inputs
      for kk=0:inputs.size()-1
        ip = inputs.get(kk);
        srcblock = block.getSourceBlock(ip.getNumber);
        % check each output port for this src block
        outputs = srcblock.getOutputs();
        for ll=0:outputs.size()-1
          % can we clear the result for this src block?
          if srcblock.canDeleteResult(ll)
            outvar = [char(srcblock.getVarName(ll)) ' = [];'];
            error('please fix the outvar name')
            evalin('base', outvar)
          end
        end
      end
    end
  end
  
  
end