How to check if a figure is closed using the big red 'X' mark?

11 views (last 30 days)
Hi! I am using a gui in my application. There are 'Ok' and 'Cancel' buttons there which upon clicking close the figure and do some additional processing before returning control to the main matlab program.
My query is how do I perform error checking if the user instead of pressing either of the two buttons, chooses to close the gui window using the window close button (big red X in windows)?
I read the documentation about CloseRequestFcn but was unable to figure it out from there.

Accepted Answer

Image Analyst
Image Analyst on 4 Feb 2015
Do you want them to do the OK button or the Cancel button if they do that? Which ever it is, just call the OK or Cancel callback from the closerequestfcn.
  3 Comments

Sign in to comment.

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!

Translated by