How to resolve Type Initializer for MWNumericArray Exception?

1 Ansicht (letzte 30 Tage)
I am encountering the following error when trying to import "MWNumericArray" in IronPython 3.4.2:
SystemError: The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWNumericArray' threw an exception.
The same code works without issues on several other PCs that have identical configurations (same OS, .NET Framework, and MATLAB Runtime). However, on one particular PC, I consistently get the error above.
How can I resolve this issue?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 7 Nov. 2025 um 0:00
To resolve the above error, please follow the below steps:
1. Run “gacutil /l MWArray” in Visual Studio Developer Command Prompt to verify the installed version of MWArray.
2. If you receive a “command not found” error, you can typically find “gacutil.exe” at:
C:\Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/gacutil
3. Once you have identified the installed version, please update your code to use:
clr.AddReference("MWArray, Version=<version_number>")
Replace “<version_number>” with the version you found in step 1. Check if this resolves the error.
4. If the issue persists, please install the latest Visual C++ Redistributable, following the instructions here:
5. After installing the redistributable, run your code again to see if the problem is resolved.
These steps should help you identify and fix the problem on the affected PC.

Weitere Antworten (0)

Kategorien

Mehr zu Deploy to .NET Applications Using MWArray API finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by