matlab event notify recursive

classdef testClass < handle
    events
        testevent
    end

    methods
        function obj = testClass
            lh = obj.addlistener('testevent', @obj.respond);
            lh.Recursive = true;
        end
        function raise(obj)
            notify(obj,'testevent');
        end
        function respond(obj, varargin)
            fprintf('Responded!\n');
            obj.raise();
        end
    end
end

你可能感兴趣的:(matlab event notify recursive)