MATLAB: How to trigger another callback in GUIDE from inside a particular callback

callinteractMATLABproperty

I have created two edit boxes in GUIDE and would like to trigger the callback for the one of them whenever the callback for the other is triggered. I would like to do this to enable error-checking in my application, as the inputs to the two edit boxes are dependent on each other.

Best Answer

Apart from triggering a callback by interacting with the GUI component, the callback can be directly called from inside the callback of the other component. The syntax should be exactly the same as that used by GUIDE when a callback is called for a particular component. Insert the following line of code into the callback of the caller component:
CalledComponent_Callback(handles.CalledComponent, [], handles)
Here, 'CalledComponent' is the 'tag' for the component whose callback is called. This is the equivalent of 'hObject'. The 'eventdata' argument is empty.
Related Question