Hi all,
I'm creating an app where an user get to load a picture of a graph (like from a scientific text book) and run a script so that he can obtain the data on the picture, i.e. adding a grid and the value of the grid, a value in pixel within the picture transform into a value within the axes of the graph. the user can then "select the position of the curve of interest" in the picture (using ginput) and the program transfer the line thus created into a line with the values as in the picture. (hope I'm being clear). as an example:
you have a picture of a graph showing the evolution of the population of deer in a forest over time. this picture when loaded into matlab would be referenced by a number of pixels. but on those pixels, the user can see that the X-axis is in unit months and the Y-axis in thousand of deer. building a grid at each value of both axis, it is then possible, for example, to put an equivalence between pixel (340, 240) and the value (May 2022/15'500) and the pixel (350,210) to the value (June 2022/12500) (hypothetical value..there has not been a massive death of deer in the forest within May :))
I have all the functions I need to make this app works but I wanted to build it "stupid proof" such that an user cannot mess up the app. one aspect I wanted to ensure was that any deletion of a curve would be traced through all the functions. so that I don't get a mistmatch between the amount of curves seen in the plot in "pixel value", and the amount of data registered in "time/deer" value.
I wanted then to add a listener to the "Children" of the axes so that whenever the amount of children change, the change can be capture by the other functions as well.
however, the property Children of axes is not setObservable. so I cannot put a listener on this.
by browsing internet, I found out that there are "hidden" events in the class matlab.graphics.axis.Axes:
m = ?matlab.graphics.axis.Axes;
e = m.EventList;
among this list, there are two events called "ChildAdded" and "ChildRemoved".
I do manage to make a listener to the "ChildAdded" event, but it seems that the "ChildRemoved" does not work, making my "stupid proof" not usable as the user would still be capable of deleting curves without the code knowing about it.
do you have any idea as to how I could solve this lack of "observability" of events linked with deletion of lines in a axes?