How to close any file without saving it?

조회 수: 32 (최근 30일)
Hannah . 2021년 8월 13일
편집: Chunru . 2021년 8월 13일
Hello, I want to know what is the command for closing a particular type of file without any requist to save it.
i.e. I want to know:
  • How can I close all files from any type of application e.g. close all txt files that are open?
  • How can I close those files automatically without saving?
I already know, for closing an excel file the following commands are used:
However when I use code, the application, (in this case excel) asks me if I want to save my file.
Excel = actxGetRunningServer('Excel.Application');
Excel.Quit; % Shut down Excel.

답변 (1개)

Chunru 2021년 8월 13일
Is "fclose all" what you want?
  댓글 수: 4
Chunru 2021년 8월 13일
편집: Chunru 님. 2021년 8월 13일
Excel = actxGetRunningServer('Excel.Application') will run the external exel server. You can check to see how the external server Quit the file without confirmation.
Try the follwing to see if you can skip the confirmation.
Excel = actxGetRunningServer('Excel.Application');
Excel.DisplayAlerts = false;
On the other hand, if you can replace the actx and use xlswrite, then you will not have the problem of confirming quit.

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


Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by