How do you close a document once it has been opened using WINOPEN in MATLAB 7.1 (R14SP3)?

13 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
There is no built-in feature in MATLAB 7.1 (R14SP3) that would enable you to close documents once they have been opened using WINOPEN.
It may be possible to open and close your other application using that application's API. The program interface of your application is specific to that application, such that we cannot supply information on accessing your program through its own API. You will need to contact that application's vendor or documentation for more information. Once you have researched the API of your other application, you should be able to connect to it using MATLAB's COM Integration. You can find more information about this in the documentation which can be accessed by typing the following command on the MATLAB Command Prompt:
web([docroot,'/techdoc/matlab_external/ch07clie.html'])
Here's an example that shows how to open and close an Excel file:
% Start Excel.
excelApp = actxserver('Excel.Application')
excelApp.visible = true;
% Open file called test.xls, located in the current folder.
excelWorkbook = excelApp.Workbook.Open(fullfile(pwd, 'test.xls'));
% Alternative: open file 'C:\Temp\test.xls'.
%excelWorkbook = excelApp.Workbook.Open('C:\Temp\test.xls');
% Close file.
% true = save changes, false = don't save changes.
excelWorkbook.Close(true);
% Close Excel.
excelApp.Quit;
% Clean up.
release(excelWorkbook)
release(excelApp)

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!