How do I create and use class constructors with app-wide scope in App Designer?

18 vues (au cours des 30 derniers jours)
MrToad
MrToad le 25 Mai 2022
I am attempting to migrate a previously hand-coded GUI app (R2017b) that includes user-defined class constructors (as distinct m-files) into App Designer (R2021a). These constructors can be called anywhere in the original GUI; does anyone know how to implement this in App Designer?
Thanks!

Réponses (1)

Hornett
Hornett le 6 Sep 2024
I understand that you trying to create and use class constructor in App Designer.
In your app, create a new class file in the same folder as your app file. Define a handle class by creating a classdef block. Below is the sample code.
classdef YourClassName < handle
% ...
end
Now define properties and methods in your class. To access the data object from within App Designer, create an instance of the class in your App Designer code and store it in a property of your app.
I hope this information helps in resolving your query.

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by