How can I imitate a user to call a callback function for a GUI object?

I am trying to programmatically create a click event in MATLAB that a user will simulate by clicking on a GUI object. The callback function for an object is a subfunction, so I cannot call it directly. However, I can get the callback property from the object, which ultimately is an array of 3 by 1 cells with the following contents:

@uiBlockFn/callback_til [ 188.0011] [1x1 struct]

How can I call this callback function in code so that it mimics what happens when a user clicks a GUI object?

+5
source share
2 answers

, hObject, :

callbackCell = get(hObject,'Callback');

, callbackCell, , 3- . ( ), ( ) , , , .

, , , , MATLAB . :

  • hObject: , .
  • eventData: , , [] ( ).

, , , ( ):

callbackCell{1}(hObject,[],callbackCell{2:end});
+7

All Articles