c# & matlab

  • Thread starter Thread starter Fabian Ruranski
  • Start date Start date
F

Fabian Ruranski

hi,

i'm searching for a way to connect matlab from c#.

im vb it is very easy:

Set MatLab = CreateObject("Matlab.Application")
result = MatLab.execute("a=5")


but im c# ????
 
Fabian Ruranski said:
hi,

i'm searching for a way to connect matlab from c#.

im vb it is very easy:

Set MatLab = CreateObject("Matlab.Application")
result = MatLab.execute("a=5")


but im c# ????

A quick search in the help-files gives me
Object MyObject;
MyObject = Server.CreateObject("Acme.Component.3");

Try searching for CreateObject and COM in the documentation for
more detailed information.
 
If it's available as a COM object or somesuch,
VS.Net should be able to build you a wrapper.
It's in Add Reference, one of the tabs at the top
is COM References, IIRC...

Have a nice day :)
Jim Bellinger
 
James F. Bellinger said:
If it's available as a COM object or somesuch,
VS.Net should be able to build you a wrapper.
It's in Add Reference, one of the tabs at the top
is COM References, IIRC...

I've tryed following :
I added reference to COM : "Matlab Application (Version 6.0) Type Library"
and then wrote this :

using MLApp;

..
..
..
private void Form1_Load(object sender, System.EventArgs e)
{
MLAppClass ml = new MLAppClass();
ml.Execute("a=5");
}

First line opens Matlab Command Window.

Second line couses exception :

"An unhandled exception of type 'System.InvalidCastException' occurred in
mscorlib.dll
Additional information: QueryInterface for interface MLApp.DIMLApp failed."

That example in VB that Fabian posted works fine. This one doesn't.
Does anybody know why?
 
Back
Top