From: Mark on
Hi.

I am trying to implement a matlab m file from vb.net. I am using the code below however it is extremely slow. it takes approximately 1 second for each iteration. In matlab its done almost instantly. I'v been googling this and refering to mathworks page and this method is all there seems to be. Is there a way of opening the matlab object (which I think is the slow part) and keeping it open so it gets faster, or something. Basically I want the speed of matlab from within VB, how do I do this.

Thanks,

Mark.

MatLab = CreateObject("Matlab.Application")

For i = 1 To 10
Result = MatLab.Execute("read_serial")
TextBox1.Text = Result
next i
From: neil on
"Mark " <grealzer(a)hotmail.com> wrote in message <i2ai2j$cj6$1(a)fred.mathworks.com>...
> Hi.
>
> I am trying to implement a matlab m file from vb.net. I am using the code below however it is extremely slow. it takes approximately 1 second for each iteration. In matlab its done almost instantly. I'v been googling this and refering to mathworks page and this method is all there seems to be. Is there a way of opening the matlab object (which I think is the slow part) and keeping it open so it gets faster, or something. Basically I want the speed of matlab from within VB, how do I do this.
>
> Thanks,
>
> Mark.
>
> MatLab = CreateObject("Matlab.Application")
>
> For i = 1 To 10
> Result = MatLab.Execute("read_serial")
> TextBox1.Text = Result
> next i

Hey Mark,

I am connecting to Matlab via C#.net. Matlab does stay open until you execute Matlab.close().
I'm pretty sure what is slow is the communication of the COM interface. If I was you I wouldn't put the Matlab.Execute command in a loop and rather execute the loop in MATLAB and return an array.

I think you should ask yourself why you are using MATLAB. If you are using it just to read from the serial port (making an assumption here) I'm pretty sure you could do that in VB. I would advise only using Matlab over COM when you have a long complex routine that would be difficult to implement in VB.
 | 
Pages: 1
Prev: xPC Target Thermocouple DAQ
Next: geotiff