MATLAB Answers

1

Observe graphics object added to the axes

Asked by Zoltán Csáti on 30 Oct 2017
Latest activity Answered by Roman Müller-Hainbach on 2 Nov 2017
I have an axes object which contains several child objects (lines, patches, etc.). I have a function which sets the callback function for these objects. What I want is that whenever the user adds another object to the axes, an event is activated and sets the callback for the newly added object. My idea was to look when the number of the children of axes grow as it indicates a new object. Unfortunately, axes.Children is not a SetObservable property, so listeners cannot be attached to the axes object. Any ideas how to solve this problem?

  0 Comments

Sign in to comment.

1 Answer

Answer by Roman Müller-Hainbach on 2 Nov 2017

Maybe the 'LegendableObjectsUpdated' event could be used for your purposes. I retrieved this from
events('matlab.graphics.axis.Axes')

  0 Comments

Sign in to comment.