Why do some Excel processes fail to terminate after using XLSREAD, XLSWRITE or XLSFINFO in MATLAB?

46 ビュー (過去 30 日間)
When I use a command that calls Excel as an ActiveX server, such as XLSREAD, XLSWRITE, or XLSFINFO, an Excel.exe process is left in memory even after the command is finished or I close MATLAB. If I am running a script with many calls to XLSREAD, the ghost processes fill up my memory.

採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 12 月 10 日
編集済み: MathWorks Support Team 2018 年 12 月 10 日
As of R2015b, this issue has been resolved as MATLAB will now only open one instance of Excel for a file and does not attempt to close it after the call.
Previous to R2015b, in some circumstances Excel may not shut down after calling XLSREAD, XLSWRITE, or XLSINFO from MATLAB.
Whenever one of these commands is executed in MATLAB on Windows and Excel is installed, a new instance of Excel is started to perform the operation using Excel's ActiveX interface. After the operation is completed, MATLAB requests that Excel quit, however in some circumstances, Excel may ignore this request.
One reason this may occur is if some other application has established an ActiveX connection to Excel and is hanging on to a reference to the interface, and not releasing it. The way ActiveX works is that if 2 applications both make connections to the same server, the server will not close until both applications have terminated their connection. The connection from MATLAB is being terminated, however it is possible that another application has made a connection to Excel. In the past we noticed an issue where Google Desktop Search would create such a connection, however starting with MATLAB 7.0.4 (R14SP2) this issue was resolved by working around the specific way that Google Desktop Search made its connection. If you are experiencing this same issue with a later version of MATLAB, or do not have Google Desktop Installed, there is likely another application on your computer which is holding on to the Excel application ActiveX reference.
One way to work around this issue is to identify the application that is causing this issue, then disable it. You can also contact the company which created the software to notify them of this issue.
Certain Excel add-ins may also prevent proper termination of Excel. Some known add-ins that might cause issues are Broadcom's "Send to Bluetooth" add-in (btsendto_office.dll) and Bloomberg's TaskpaneHost add-in. Disabling the add-ins that cause issues is a possible workaround.
When you use a Bloomberg add-in, that causes this issues: Please open a help chat (by pressing the help key twice on the Bloomberg keyboard) and ask for the technical departement. Bloomberg will then have a look into these issues.
As a last resort you can use the SYSTEM command via MATLAB to kill the process.
system('taskkill /F /IM EXCEL.EXE');
  3 件のコメント
Image Analyst
Image Analyst 2016 年 1 月 9 日
編集済み: MathWorks Support Team 2022 年 11 月 16 日
Starting with R2015b, Excel does not shutdown after calls to xlsread() or xlswrite(). However there should be only one instance running:
Data Import and Export
Excel Spreadsheets: Read and write to the same spreadsheet repeatedly with improved performance of xlsread, xlswrite, readtable, and writetable functions
Repeated calls to the xlsread, xlswrite, readtable, and writetable functions show significant performance improvement.
Jan
Jan 2017 年 11 月 30 日
Moved from a flag of lux :
it's very helpful, tks
@lux: Please use flags only to inform the admins and editors about contributions, which might collide with the terms of use e.g. by rudeness. Thanks.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by