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
