Hi Jon,
To incorporate the plot’s callback function in an app designed with the UIAxes component, MATLAB's built-in callback functions can be used.
The ‘ButtonDownFcn’ callback is effective for detecting user interactions with the plot, such as selecting plotted objects.
Refer to the following example code snippet:
plot(app.UIAxes, x, y, 'ButtonDownFcn', @(src, event) plotClicked(app, src));
function plotClicked(app, src)
% Plot object
plotObject = src;
% Perform additional actions based on selection
disp(['Selected plot: ', plotObject]);
% Perform tasks on plot object
end
Refer to the following MathWorks Documentation to learn more about ‘ButtonDownFcn’ (Button Down Callback Function): https://www.mathworks.com/help/releases/R2022a/matlab/creating_plots/button-down-callback-function.html
I hope this helps.