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


I would like to close documents once they have been opened using WINOPEN.

Best Answer

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:
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.
% Close Excel.
% Clean up.