How to resolve Type Initializer for MWNumericArray Exception?

1 回表示 (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2025 年 11 月 7 日 0:00
回答済み: MathWorks Support Team 2025 年 11 月 14 日 20:06
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?

採用された回答

MathWorks Support Team
MathWorks Support Team 2025 年 11 月 7 日 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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeploy to .NET Applications Using MWArray API についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by