Cameron's idea of calculating the axes position within the figure position should work, and it is the only way with currently documented/supported matlab that I can think of too, though it would be nice if someone else could chime in.
The solution of extracting the actual axes object from the uiaxes is along the lines of what I would have suggested. But rather than create a uiaxes and get the axes from within, you can also create regular axes() inside a uifigure, and it will behave as usual (I haven't tested exhaustively, but it seems to be more or less interchangeable, except for behavior on resizing).
- In app designer, create a uipanel to be the container of the axes (because within appdesigner gui edtor you can't add an axes, only uiaxes), call it for example "AxesContainerPanel"
- In the code editor add a property called "UIAxes" (or whatever you want to call it)
- In the code editor add a startup function for the app
- In the startup function, create the axes:
app.UIAxes = axes(app.AxesContainerPanel,"ButtonDownFcn",@(o,e)AxesBDF(app,o,e))