Do functions like "linkaxes" or "linkprop" work with uifigure in AppDesigner?

9 vues (au cours des 30 derniers jours)
When building an app with App Designer, the "linkaxes" and "linkprop" functionalities do not seem to work on "uifigure". Linking axes and their properties helps in obtaining insightful observations. It would be nice if this works.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 21 Mai 2020
As of MATLAB R2020a, the "linkaxes" and "linkprop" functionalities are not supported using uifigure in App Designer. Our development team has been notified of this enhancement, and will consider it for future releases of MATLAB.
In the meantime, starting in MATLAB R2020a, you can use regular Axes within App Designer, and both "linkprop" and "linkaxes" are fully supported by regular axes when used within App Designer. Note that, in order to create a regular axes in App Designer, you need to programmatically call the "axes" command. My recommendation is to create a panel in your App while designing your app, and then use that panel as the parent for the axes.
A simple example about how to use regular Axes in an app written in App Designer is as follows:
1. Create a new app.
2. Drag a panel into your app where you want your axes. Set the "Title" to empty to remove the title from the panel. You can also change the border if desired.
3. Add a new property called "Axes", as follows:
properties
Axes matlab.graphics.axis.Axes
end
4. In the "Code View", create a new Callback for the the UIFigure's StartupFcn.
5. Add this code to the new "startupFcn" (please note that both the signature and the end of the function will be generated automatically by App Designer for you)
function startupFcn(app)
app.Axes = axes(app.Panel);
end
You can then use "linkaxes" and "linkprop" on the app.Axes property.

Plus de réponses (0)

Catégories

En savoir plus sur Develop uifigure-Based Apps dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by