How to resolve Type Initializer for MWNumericArray Exception?

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Deploy 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