MATLAB: CloseRequestFcn for Matlabs main window

closerequestfunctionMATLAB

Hello toghether,
i have some variables, that i want to have saved, when matlab is closed? I know startup.m is a script, which is executes at matlabs startup, but is there something similar for matlabs shutdown?
Thank you for your help
Rafael

Best Answer

Never mind. I found the solution. If there is a file called finish.m it the searchpath or in the current folder, matlab executes it when its closed.