FUNCTION REFERENCE
matlab.apps.AppBase.createCallbackFcn
Wrap a matlab.apps.AppBase method as a UI component callback handle.
Wrap a matlab.apps.AppBase method as a UI component callback handle.
Syntax
cb = createCallbackFcn(app, @callbackFcn)Syntax
cb = createCallbackFcn(app, @callbackFcn, requiresEvent)Returns a function handle that calls callbackFcn(app, event) when requiresEvent is true, or callbackFcn(app) otherwise, with access to private methods of app's class.
Example
d = tempname; mkdir(d); addpath(d); writelines(["classdef CbMHelpApp < 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 = CbMHelpApp","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, "CbMHelpApp.m")); a = CbMHelpApp; isa(a.Btn.ButtonPushedFcn, 'function_handle'); delete(a); rmpath(d); rmdir(d, 's')These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.