What is matlab.apps.AppBase

조회 수: 27 (최근 30일)
Siaw Chong Lee
Siaw Chong Lee 2022년 7월 13일
편집: Praveen Reddy 2023년 8월 30일
In app designer, the first line of code is
classdef app1 < matlab.apps.AppBase
but I cannot find any documentation about this class. Can someone elaborate a bit?
I was trying to create a class from scratch without app designer, and I came across the issue that I cannot assign a callback to a button like this
app.Button.ButtonPushedFcn = @app.buttonCallback
but must do
app.Button.ButtonPushedFcn = createCallbackFcn(app, @buttonCallback, true)
The error that I got is
Error using app1/buttonCallback
Too many input arguments.
I guess the callbacks must be associated using a special way by calling the createCallbackFcn from matlab.apps.AppBase?
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 7월 13일
Did you try
app.Button.ButtonPushedFcn = @buttonCallback
Siaw Chong Lee
Siaw Chong Lee 2022년 7월 14일
Yes I tried that, it does not work because the buttonCallback function is not recongnizable

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

채택된 답변

Praveen Reddy
Praveen Reddy 2023년 8월 29일
편집: Praveen Reddy 2023년 8월 30일
Hi Siaw,
I understand that you are getting an error while trying to create call back to a button by inheriting “matlab.apps.AppBase. The matlab.apps.AppBase” class provides various features and functionality specific to App Designer, such as managing the app's components, handling events, and generating the user interface. It serves as the base class for your custom app class, allowing you to inherit and utilize the built-in functionality provided by App Designer. The error you are facing is due to an incorrect usage of the function, createCallBackFcn" requires you to pass “app”, “callback”,eventData as the three input arguments.
Hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by