How to create a class in AppDesigner

35 次查看(过去 30 天)
Sai Teja G
Sai Teja G 2023-10-13
评论: DGM 2024-12-30,13:34
In R2023a, I want to know how can I create a class and subclass in the AppDesigner.

回答(1 个)

Daniel Hediger
Daniel Hediger 2023-10-13
编辑:DGM 2024-12-30,13:32
Opening App Designer:
  • Launch App Designer by running a command like openExample('matlab/PulseGeneratorAppExample') to open a working copy of an example app. From there, you can modify and reorganize the app code, and write a MATLAB class to manage app data link.
Creating a Subclass:
  • To create a subclass of another class, you would add the superclass to the classdef line followed by a < character. The syntax would look like this: classdef ClassName < SuperClass. If inheriting from multiple classes, use the & character: classdef ClassName < SuperClass1 & SuperClass2 link.
Creating Custom UI Components:
  • You can create custom UI components either interactively in App Designer or programmatically as a subclass of the matlab.ui.componentcontainer.ComponentContainer base class. Once created, these custom components can be configured for use within App Designer link.
Subclassing App Designer Components:
  • There is a mention that MATLAB does not accept a uifigure having a non-native MATLAB class as a children. However, as an alternative solution, the UserData property of any MATLAB object can be used link.
  4 个评论
DGM
DGM 2024-12-30,13:24
Simon Eisenlohr flagged this with the comment:
Terible
DGM
DGM 2024-12-30,13:34
This does look like AI chaff, but it does have some relevant documentation links. They were just not readily visible, so I reformatted it to increase link prominence. It's at least an improvement.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by