MATLAB Answers

App Designer - 'Global' Callback

조회 수: 8(최근 30일)
Kyle Steiner
Kyle Steiner 2019년 9월 26일
답변: Pranjal Kaura 2021년 7월 28일
I'm building a GUI in the App Designer for the first time (screenshot below).
This is to control a phased array antenna for research in my graduate program. I provide user control of the phase, attenuation, polarity, and enable for each element as well as beamforming synthesis.
I'd like to have a table which updates for any user interaction event, so the user can see what commands will be sent to the array (table is in the upper right of the screenshot). However, I don't see a way to create a global callback function that will execute for any user interaction.
I saw this example (, which allows a single callback to be controlled by multiple components. But it appears that a given component can only be tied to one callback.
My workaround is to create an update_table function which I would include with every callback. However, this feels a bit cumbersome.
Is there a way to execute a code snippet for a global event - ie. any time the user clicks a butten or enters text in the GUI? All the callback options I'm seeing pertain to a particular component.
Thank you,


Pranjal Kaura
Pranjal Kaura 2021년 7월 28일
Hey Kyle,
It is my understanding that you want to develop a callback that is activated whenever the user interacts with the GUI. You do not want to use component wise callbacks.
You could refer to the Write Callbacks for Apps page and look at the:
  1. WindowButtonDownFcn: End user presses a mouse button while the pointer is in the figure window.
  2. WindowKeyReleaseFcn: End user releases a key while the pointer is on the figure or any of its child objects.
This could be a workaround to create the 'global' callback function that you need. The update_Table function could then be added to these callbacks.

Community Treasure Hunt

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

Start Hunting!

Translated by