How do I run the callback routine for a pushbutton from the command line in MATLAB 7.0.4 (R14SP2)?
5 views (last 30 days)
Show older comments
I want to execute a GUI object callback function from the MATLAB Command line, or another function.
Accepted Answer
MathWorks Support Team
on 21 Jan 2010
One way to run the callback function from the Command Window is to run the GUI function with arguments including the appropriate callback function, the handle to the object associated with the callback function, the event, and the 'handles' structure.
The easiest way to obtain the necessary information is to make the 'handles' structure the output of the GUI code. To do this, change the following line in GUI create function "myGUI_CreateFcn":
handles.output = hObject;
to
handles.output = handles;
then execute the following at the MATLAB Command Prompt
h = myGui;
myGui('pushbutton1_Callback',h.pushbutton1,[],guidata(h.pushbutton1))
The above example executes the callback function for a pushbutton object with an object 'Tag' property set to 'pushbutton1'.
0 Comments
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks 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!