Thread Subject: exchange data betwwen matlab and VB2005

Subject: exchange data betwwen matlab and VB2005

From: Vincent

Date: 8 Oct, 2007 19:34:28

Message: 1 of 5

Can someone give me an example on how to send data between
a matlab program and a Vb2005 program.

I want to be able to send a simple string ( let's say
"hello world" ) from a matlab script to a running program (
a visual basic 2005 program )

I also want to read back a string from that visual basic
program.

There used to be DDe but that seems to have gone away.

I have a Vb program that handels access to custom
testhardware. I need to be able to read and write data to
that vb program from a matlab script.

I googled but can;t find a real example. ( both matlab
script and the Vb code.)
if i can pass strings between the program's that is all i
need. i can do the rest.

Subject: exchange data betwwen matlab and VB2005

From: Dan Haeg

Date: 8 Oct, 2007 20:45:22

Message: 2 of 5

"Vincent " <nospan.vincent.himpe@st.com> wrote in message
<fee0o4$qqm$1@fred.mathworks.com>...
> Can someone give me an example on how to send data between
> a matlab program and a Vb2005 program.
>
> I want to be able to send a simple string ( let's say
> "hello world" ) from a matlab script to a running program (
> a visual basic 2005 program )
>
> I also want to read back a string from that visual basic
> program.
>
> There used to be DDe but that seems to have gone away.
>
> I have a Vb program that handels access to custom
> testhardware. I need to be able to read and write data to
> that vb program from a matlab script.
>
> I googled but can;t find a real example. ( both matlab
> script and the Vb code.)
> if i can pass strings between the program's that is all i
> need. i can do the rest.


search this site for matlab.execute

Subject: exchange data betwwen matlab and VB2005

From: Vincent

Date: 15 Feb, 2008 03:47:01

Message: 3 of 5

Sorry, that's not what i am looking for.
Let me detail.

on the SAME computer 2 programs are running
- Matlab
- A program written in VB 2005 and COMPILED to an
executable.

I want to be able to write a script in matlab that can send
information to the running VB program.

The MAtlab script is in control !

My question are the following

- how do i expose internal functions and procedures from
the VB program to matlab ?

For eaxmple the VBprogram has the following 2 functions

Public sub Write (address as data32,data as int32)
public function Read(address as int32) as int32

What do i need to specify so these functions become visible
to the outside world ?

Then the other part is : What do i write in matlab to 'call
these functions ?

Keep in mind that the VB program is running on the machine.
The matlab script needs to be able to detect that the
program is running ( if its not running the matlab script
should stop and give a warning ), hook into it and call the
functions and pass data ( mostly int32 int64 , double and
single. i don't pass complex constructions like arrays. its
all simple, single values.

Subject: exchange data betwwen matlab and VB2005

From: Atrish Mukherjee

Date: 15 Feb, 2008 10:12:01

Message: 4 of 5

"Vincent " <nospan.vincent.himpe@st.com> wrote in message
<fp31vl$mfp$1@fred.mathworks.com>...
> Sorry, that's not what i am looking for.
> Let me detail.
>
> on the SAME computer 2 programs are running
> - Matlab
> - A program written in VB 2005 and COMPILED to an
> executable.
>
> I want to be able to write a script in matlab that can send
> information to the running VB program.
>
> The MAtlab script is in control !
>
> My question are the following
>
> - how do i expose internal functions and procedures from
> the VB program to matlab ?
>
> For eaxmple the VBprogram has the following 2 functions
>
> Public sub Write (address as data32,data as int32)
> public function Read(address as int32) as int32
>
> What do i need to specify so these functions become visible
> to the outside world ?
>
> Then the other part is : What do i write in matlab to 'call
> these functions ?
>
> Keep in mind that the VB program is running on the machine.
> The matlab script needs to be able to detect that the
> program is running ( if its not running the matlab script
> should stop and give a warning ), hook into it and call the
> functions and pass data ( mostly int32 int64 , double and
> single. i don't pass complex constructions like arrays. its
> all simple, single values.

first of all you have to write matlab functions instead of
script. then use matlab combuilder to build the com
files(dll) for that function or functions. Then add the com
file as a reference in your vb project. you will be able to
call the matlab functions from visual basic as simple
functions. You can pass parameter to those functions and can
receive their output to use further in visual basic project.
You need to run MCR installer running on the machine if you
dont have matlab installed on that machine wher you want to
run that application.
I think this information will help you..

Subject: exchange data betwwen matlab and VB2005

From: John reilly

Date: 15 Feb, 2008 13:03:01

Message: 5 of 5

Vincent,

Does your VB side need to be an executable? You could write
yourself a little COM object in VB.NET, instantiate it in
your MATLAB code and just call the Read/Write methods. I
did it in C# and it was fairly painless.

If it does need to be an executable, the only thing I can
suggest is a TCP or UDP socket.

hth.

reilly.


"Vincent " <nospan.vincent.himpe@st.com> wrote in message
<fp31vl$mfp$1@fred.mathworks.com>...
> Sorry, that's not what i am looking for.
> Let me detail.
>
> on the SAME computer 2 programs are running
> - Matlab
> - A program written in VB 2005 and COMPILED to an
> executable.
>
> I want to be able to write a script in matlab that can send
> information to the running VB program.
>
> The MAtlab script is in control !
>
> My question are the following
>
> - how do i expose internal functions and procedures from
> the VB program to matlab ?
>
> For eaxmple the VBprogram has the following 2 functions
>
> Public sub Write (address as data32,data as int32)
> public function Read(address as int32) as int32
>
> What do i need to specify so these functions become visible
> to the outside world ?
>
> Then the other part is : What do i write in matlab to 'call
> these functions ?
>
> Keep in mind that the VB program is running on the machine.
> The matlab script needs to be able to detect that the
> program is running ( if its not running the matlab script
> should stop and give a warning ), hook into it and call the
> functions and pass data ( mostly int32 int64 , double and
> single. i don't pass complex constructions like arrays. its
> all simple, single values.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com