How to create a class in AppDesigner

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일

0 개 추천

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

Christopher Stapels
Christopher Stapels 2023년 10월 13일
@Daniel Hediger Please review the guidelines about using AI to answer questions. Though it is allowed, we appreciate if you clearly indicate that you used AI for your answer. https://www.mathworks.com/matlabcentral/content/community-guidelines.html
Josiah Brough
Josiah Brough 2024년 3월 11일
Terrible answer and it should have been deleted knowing that it is just AI spam... "how do I add a class?" .. "Simple you open the app and add a class." Not helpful at all.
DGM
DGM 2024년 12월 30일
Simon Eisenlohr flagged this with the comment:
Terible
DGM
DGM 2024년 12월 30일
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2023년 10월 13일

댓글:

DGM
2024년 12월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by