Is there a version of XLSWRITE in MATLAB 7.6 (R2008a) that uses an existing instance of Excel when writing data?

1 view (last 30 days)
I use XLSWRITE repeatedly in my MATLAB code, often within a for loop. Looking at the code for "xlswrite.m", I observe that the function opens an instance of Excel and shuts it back down whenever it is called. This is a cause for a lot of overhead, and makes the overall execution time of my code slow.
I would like a version of XLSWRITE that can latch on to an instance of Microsoft Excel that is already running, and uses a Workbook in that instance to write data.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Feb 2021
Edited: MathWorks Support Team on 17 Feb 2021
The ability for the built-in XLSWRITE function to use an existing instance of Microsoft Excel when called is not available in MATLAB 7.6 (R2008a).
To work around this issue, the following MATLAB Central File Exchange submission implements an alternative version of XLSWRITE that can latch on to an existing ActiveX or COM Automation Server instance of Excel:
Note that this submission was authored by a contributor external to MathWorks. Specific questions regarding its implementation should be directed to the contributor, whose contact information can be found on the above linked page.
Also, a custom implementation of XLSWRITE can be written that uses the ACTXGETRUNNINGSERVER function to obtain a reference to an existing instance of Excel. The above submission does not use this particularly useful function.
For more information on ACTXGETRUNNINGSERVER, refer to the following MATLAB Help page:
You may access the same page locally by typing the following at the MATLAB prompt:
web([docroot,'/techdoc/ref/actxgetrunningserver.html'])

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

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

Start Hunting!