FUNCTION REFERENCE
createCallbackFcn
Create a UI component callback wrapper for an AppBase app method.
Create a UI component callback wrapper for an AppBase app method.
Syntax
cb = createCallbackFcn(app, @callbackFcn)Syntax
cb = createCallbackFcn(app, @callbackFcn, requiresEvent)Returns a function handle suitable for UI component callback properties (such as ButtonPushedFcn or ValueChangedFcn) that invokes callbackFcn(app, event) when requiresEvent is true, or callbackFcn(app) when requiresEvent is false (default), with access to private methods of app's class.
Example
d = tempname; mkdir(d); addpath(d); writelines(["classdef CbHelpApp < matlab.apps.AppBase","properties","UIFigure matlab.ui.Figure","Btn matlab.ui.control.Button","end","methods (Access = private)","function onPush(app, ~)","end","end","methods","function app = CbHelpApp","app.UIFigure = uifigure('Visible','off');","app.Btn = uibutton(app.UIFigure);","app.Btn.ButtonPushedFcn = createCallbackFcn(app, @onPush, true);","registerApp(app, app.UIFigure);","end","end","end"], fullfile(d, "CbHelpApp.m")); a = CbHelpApp; isa(a.Btn.ButtonPushedFcn, 'function_handle'); delete(a); rmpath(d); rmdir(d, 's')Differences from MATLAB: App Designer visual editor, .mlapp packaging, App Testing Framework (matlab.uitest), web apps, and ComponentContainer are not supported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.