How to Return value from Callback function to the main function?
Mostra commenti meno recenti
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.
Risposta accettata
Più risposte (1)
Benjamin Blacklock
il 24 Apr 2019
0 voti
It's bad practice but you can use global variables to communicate between the functions.
Categorie
Scopri di più su App Building in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!