image thumbnail
from Comparison of C++, Java, Python, Ruby and MATLAB Using Object Oriented Example by Stuart McGarrity
RedBlack Tree Binary Search Example Used to Compare of C++, Java™, Python, Ruby and MATLAB® Code

NodeVisitor
classdef NodeVisitor < handle
    % Inheriting from handle class provides reference behavior
    % Copyright 2008-2009 The MathWorks, Inc

    methods
        function visit(self,node,depth)
            if ~isempty(node.val)
                fprintf('(%d:%d:%d), ', node.val, node.color, depth);
            end
        end
    end
end

Contact us at files@mathworks.com