GUI option to return no output
Show older comments
I am programming a GUI that waits (uiwait) for the user to select some points on an axes object. I have one pushbutton ("Accept") that closes the figure and returns the points' coordinates.
However I have another button ("Cancel") that I just want to close the figure, but return nothing.
I have viewed and implemented the setup in Doug Hull's video (using uiresume, delete(hObject), etc). But whether I close the figure with Accept, Cancel or the window-close button, the OutputFcn is always called.
I have 2 thoughts on overcoming this. Since I am using appdata to store the points, I thought that I could:
- Set the return variable to empty within appdata when the Cancel button is clicked, or
- Store another variable in appdata, called strExitButton, where I set it to name of the button clicked. Then that value is called up in OutputFcn to determine whether to return the coordinates or an empty matrix.
Is there a better way to do this? If not, which option above is the better choice?
Many thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown 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!