Call Matlab from C # using a COM Object

I am trying to create a simple C # GUI that uses Matlab to process it. I try to use the Matlab application COM object for communication, but when distributing I get the following error:

An unhandled exception of type "System.Runtime.InteropServices.COMException" occurred in cSharpCallsMATLAB.exe

Additional Information: Retrieving the factory COM class for a component with CLSID {491B6189-7E9D-43F4-A7DE-C062DF7B326E} failed due to the following error: 80080005.

Earlier, I create the necessary object:

Private MLApp.MLAppClass ml;

and assign it in the form constructor:

ml = new MLApp.MLAppClass ();

and the program freezes on this line and returns an error after about 5 seconds.

I looked around, but I can not solve this problem. Does anyone have any tips on how to get C # to successfully connect to Matlab?

Thank!

+5
source share
1 answer

First of all, look here:

If this does not help, try Turning on unsafe mode , it may solve some problems with COM objects.

+3
source

All Articles