From spreadsheet block - sl_iofile:​excelfile:​BlockSimEr​ror Microsoft Excel was not registered properly

2 vues (au cours des 30 derniers jours)
When simulating a simulink model with a "From spreadsheet" block using from Jenkins with runMatlabCommand, I get the following error. When I simulate the model from within matlab it works fine. Can anyone tell me what this error means or where I should look to fix it? It has something to do with matlab not finding excel, but I already reinstalled office and matlab. To no avail. How is the from spreadsheet calling excel (through activex?)?
Thank you,
Diederik
--------- Error ID: ---------
'sl_iofile:excelfile:BlockSimError'
-------------- Error Details: --------------
Error using testCheck_test_thermalHouse_1zone (line 8) Error encountered in block test_thermalHouse_1zone/thermalHouse_1zone/Weather_logging/rhEnv/From Spreadsheet Caused by: Microsoft Excel was not registered properly.

Réponses (1)

Harimurali
Harimurali le 10 Jan 2024
Hi Diederik,
There are several reasons why this issue can occur. If you are getting this error, it means MATLAB is not able to connect to Excel due to some issue on your system. It is not a MATLAB error but rather an error associated with the Jenkins service or a Windows-produced error. Please see the following possible reasons and troubleshooting steps for this issue:
1. The anti-virus software may be creating an issue with MS Office. Please try disabling or repairing the anti-virus software and checking if it resolves the issue.
2. Ensure that the Jenkins service (or the user account running Jenkins) has the necessary permissions to access Excel and the file system where the spreadsheet is located.
3. In order to determine if the issue is with MATLAB or Excel, please start Windows PowerShell (click start, type 'powershell' and open the Windows PowerShell app). In the power shell, please type this:
$excel = New-Object -ComObject excel.application
(If this produces an error, then the issue is not due to MATLAB)
4. It might also mean a corrupt installation of the MS Office Suite. If your office installation is corrupt, you can try to repair the Microsoft Office installation by opening the 'Apps and Features' window from the start menu, searching for the Microsoft Office application, clicking on it, then clicking the "Modify" option, and selecting > "Quick Repair".
Then, execute the following command in the 'MATLAB' command window:
excel = actxserver('Excel.Application') %this command should not produce any errors if the issue has been resolved.
5. Re-Register the Excel Application: From a command prompt, please navigate to where the Excel EXE file is located and re-register the application. To find the file path of the Excel EXE file, open the start menu, type "excel.exe" and click on "Open file location". This can be done as shown below:
Type cmd in the START menu, and it will show you “Command Prompt” as the best match to your search. Then right-click on it and select “Run as administrator”. This should open a command prompt. Now, type the following:
CD C:\Path\to\folder\containing\excel.exe
EXCEL.EXE REGSERVER
If none of the above measures work, a possible workaround could be to import the data from the Excel sheet to the MATLAB workspace and use the "From Workspace" block in Simulink instead of the "From Spreadsheet" block.
Refer to the below documentation for information about the "From Workspace" block:
Hope this helps.

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by