Filter löschen
Filter löschen

How to create a class in AppDesigner

30 Ansichten (letzte 30 Tage)
Sai Teja G
Sai Teja G am 13 Okt. 2023
Kommentiert: Josiah Brough am 11 Mär. 2024
In R2023a, I want to know how can I create a class and subclass in the AppDesigner.

Antworten (1)

Daniel Hediger
Daniel Hediger am 13 Okt. 2023
  1. 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​1​.
  1. 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 & SuperClass22​.
  1. 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​3​.
  1. 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​4​.
  2 Kommentare
Christopher Stapels
Christopher Stapels am 13 Okt. 2023
@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 am 11 Mär. 2024
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by