Accessing MATLAB from a .NET application

2 visualizzazioni (ultimi 30 giorni)
mclaus000
mclaus000 il 10 Giu 2019
I'm attempting to integrate a MATLAB .NET assembly that was supplied by a coworker into my VB.NET winforms application.
Before I even try to use the class that is in the .NET assemblies that he sent me, I needed to get the MATLAB runtime set up on my PC
  • I downloaded and installed V9.3 from the Mathworks website.
  • The install ran with no problems
  • I have a C:\Program Files\MATLAB\MATLAB Runtime\v93 directory on my PC with a bunch of stuff in it
  • I verified that my PATH environment variable includes C:\Program Files\MATLAB\MATLAB Runtime\v93\runtime\win64
  • I found the MWArray.DLL where documentation saidt would be and added a reference in my application ( C:\Program Files\MATLAB\MATLAB Runtime\v93\toolbox\dotnetbuilder\bin\win64\v4.0\MWArray.dll)
But whenever I try to do the simplest thing in my application with any of the mathworks classes, I get exceptions
for example, I add the statement
dim test as new MWNumericArray()
It compiles OK, but at run-time I get an exception with 3 inner exceptions
The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWNumericArray
The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception
The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B
Any advice on how to get started here? Is there some way to verify that my runtime is installed correctly?
Thanks in advance
  • mclaus

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by