How can I call a matlab function from a pushbutton callback from matlab gui ? Elaborate in details pls.
5 views (last 30 days)
Show older comments
I want to call a simple matlab function which returns a value. The function needs to be called when the pushbutton is clicked from the gui. I have already created the gui using guide. I just need to call the working function on the button-click. Kindly give me the details how can I do that ?
0 Comments
Answers (1)
Walter Roberson
on 20 Mar 2014
In the callback code, put in the call to the function, passing in appropriate arguments, just like if you had typed it on the command line. For example
function button1_callback(hObject, event, handles)
result = my_function(handles.parameter1_value);
set(handles.output_box, num2str(result);
end
0 Comments
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!