MATLAB: Function of the toolbar-cross

closing functionx-button

Hey everyone, does anyone know how/where to edit a GUI's closing function (if there even is one)? I'm not talking about commands like close but the X-button in the top right corner of the window. By hitting the X-button I want my GUI to call a certain function. Any ideas?

Best Answer

This does execute the CloseRequestFcn of the figure:
function exampleCloseReq
figure('CloseRequestFcn',@closeme)
function closeme(src,evt);
disp('I''m closing');
delete(src)
Save this as exampleCloseReq.m
Related Question