bsripgh
bsripgh

Reputation: 51

Calling Matlab from C# using COM object

I'm trying to make a simple C# GUI that uses Matlab for its processing. I'm trying to use the Matlab application COM object for communication but am getting the following error during allocation:

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

Additional information: Retrieving the COM class factory for 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 hangs on that line and returns an error after about 5 seconds.

I've looked around but can't seem to fix this problem. Does anyone have any advice on how to get C# to successfully connect to Matlab?

Thanks!

Upvotes: 5

Views: 4437

Answers (1)

Pascal Qyy
Pascal Qyy

Reputation: 4502

First of all, take a look here:

If it don't help, try to Enable Unsafe Mode, it may solve some problems with com objects.

Upvotes: 3

Related Questions