How can I call a matlab function from a pushbutton callback from matlab gui ? Elaborate in details pls.
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2014-3-20
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!