How to Return value from Callback function to the main function?
Show older comments
function PID_Calc
f=figure('position',[10,10,1000,1000]);
hget1 = uicontrol(...
'style','pushbutton',....
'string','G(s)',.....
'position',[200,500,100,50],....
'callback',{@getgsbutton_callback});
f.visible='on';
char x;
uiwait();
display(y);
end
function x = getgsbutton_callback(source,eventdata)
answer = inputdlg('What is the Numerator equation');
display(answer);
x = str2double(answer{:});
display(x);
%display(y);
return
end
This is a code i have written to get value from a user using GUI. Please guide me on how to get the user input from the call back function to the main function.
Accepted Answer
More Answers (1)
Benjamin Blacklock
on 24 Apr 2019
0 votes
It's bad practice but you can use global variables to communicate between the functions.
Categories
Find more on App Building 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!