How can I call a matlab function from a pushbutton callback from matlab gui ? Elaborate in details pls.

2 Ansichten (letzte 30 Tage)
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 ?

Antworten (1)

Walter Roberson
Walter Roberson am 20 Mär. 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

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by