closeRequestFcn for Matlabs main window

조회 수: 1 (최근 30일)
Rafael Kübler
Rafael Kübler 2017년 7월 13일
댓글: Steven Lord 2017년 7월 13일
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

채택된 답변

Rafael Kübler
Rafael Kübler 2017년 7월 13일
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.
  댓글 수: 1
Steven Lord
Steven Lord 2017년 7월 13일
finish.m is one approach, but it does assume that you always want to run the same code every time MATLAB exits. What if you started MATLAB but didn't create the variables that finish.m expected to save?
If you want MATLAB to prompt you before closing so you can perform more general cleanup operations, open the Preferences (in the Environment section of the Home tab of the Toolstrip) and expand the MATLAB > General > Confirmation Dialogs entry. One of the dialogs you can enable is "Confirm before exiting MATLAB". By default is is not enabled.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by