How to define a ButtonDownFcn function inside a GUI app ?

1 vue (au cours des 30 derniers jours)
Ali Ghader
Ali Ghader le 24 Avr 2018
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 ?

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by