How to determine if object has a defined event

1 Ansicht (letzte 30 Tage)
TADA
TADA am 27 Jan. 2019
Beantwortet: TADA am 6 Feb. 2019
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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Use COM Objects in MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by