Return output from the main function after a specific callback
Ältere Kommentare anzeigen
I am building a GUI programatically. I created a main function which sets the GUI objects and their callback definitions. After a specific event occurred (right mouse click), I want to return the coordinates clicked so far, i.e. end the main function with the returned values ( P, in the pseudocode below).
function P = main
set GUI elements
set callback: myCallback
end
function myCallback(varargin)
handle the mouse click event:
if leftMouseButton
store the clicked coordinates in the UserData property
else
return stoppingSignal
end
end
The clicking detection works well, but how to end function main? One dirty way I thought of is to call the CloseRequestFcn and within that use assignin('base', 'P', P), but isn't there a better solution?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu App Building finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!