I have the following UIFigure
:
classdef gui < matlab.apps.AppBase
...
function app = gui
% Construct app
end
...
properties (Access = public)
myFuncRef = @myFun
end
...
function myFun(app)
% do something
end
...
end
in which I have defined the method myFun
.
If the figure is running (that is, it's showing a window), how can I invoke the method myFun
from the Command Window of MATLAB ? I tried with
h = findobj(0, 'type', 'figure');
funcRef = get(h, 'myFuncRef');
funcRef(h);
but I get the error
An error occurred while running the simulation and the simulation was terminated Caused by: Function 'subsindex' is not defined for values of class 'matlab.graphics.GraphicsPlaceholder'.
Thanks in advance!