Clear Filters
Clear Filters

How to define a ButtonDownFcn function inside a GUI app ?

4 views (last 30 days)
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 ?

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!