How to define a ButtonDownFcn function inside a GUI app ?

4 次查看(过去 30 天)
Hello All,
I have a gui at which I am drawing an image, named 'im', inside a UIAxes object.
I am able to define the ButtonDownFcn property, called fcn, of im:
im = imagesc(app.UIAxes2,Plot_Entities.WK{1},Plot_Entities.WK{2},Plot_Entities.WK{3});
im.ButtonDownFcn = @fcn;
and it indeed calls it whenever I click on im. but I am getting an error saying the following (although i defined fcn inside the gui code):
(( Undefined function 'fcn' for input arguments of type 'matlab.graphics.primitive.Image'.
Error while evaluating Image ButtonDownFcn. ))
which is solved when I define fcn outside the gui app.
my question here: can I define fcn inside the code of GUI app itself ? or it should always be defined in the path ?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by