Plot selection in appdesigner

조회 수: 3 (최근 30일)
Jon Vegard Venås
Jon Vegard Venås 2023년 7월 31일
답변: Sandeep Mishra 2024년 10월 11일
Is it possible to have the "Edit plot" tool in an UIaxis in appdesigner? I need it to enable callback functions for selection of curves and surface objects.

답변 (1개)

Sandeep Mishra
Sandeep Mishra 2024년 10월 11일
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by