How to determine if object has a defined event

5 views (last 30 days)
Is there a way to determine if an object instance imlements an event like ismethod for methods and isprop for properties?
I tried isevent but it seems to be related only to COM components
I know I can use metaclass but it's much more tedious
and i don't mean something like that:
try
addlistener(whatever goes here);
catch ME
% no such event
end

Accepted Answer

TADA
TADA on 6 Feb 2019
Best method I found was
ismember('EventName', events(obj));

More Answers (0)

Categories

Find more on COM Component Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!