01-11-2011 05:33 AM
Hi pippo2tan,
IMHO there are few options:
1) Most simple and slow - Create two VI's with shared variable on both machines, and use a matlab script to
share data. (this makes matlab some kind of "slave")
2) More advanced but still relatively slow (Create two VI's with shared variable, on the Matlab machine build the .NET
dll, and it can be used on Matlab too ( at least at 2010b version, earlier version support only COM)
3) Create TCP/IP connection between two comps.
4) There is "out of the box" NI products, that communicate with Simulink models, don't remember the name...
...not mention the .dll here 🙂
Michael.
01-11-2011 06:05 AM
pippo2tan,
Im actually using SIT to exchange data between Simulink (Matlab 2009) and LabView (2009). They are in the same PC, but you could use SIT to connect LabView and Simulink in different PC's via IP address with ease.
The procedure to set up the link is very straightforward if you have already installed the SIT Toolbox.
You could follows the instructions on the NI SIT Help, or you could read my attached PDF. I made it for my colleagues. Warning! is in Spanish (I'm from Argentina ), however is very easy to follow.
Basically, you must install (if not yet done) the SIT toolbox, after the MATLAB installation. Then, every time Matlab starts, the SIT "connection toolbox" is automatically initialized (opens a UDP port, adds Simulink support, etc).
To exchange data, you must add a special block in your Simulink top-most diagram. In LabView, you could map Indicators and Controls via the SIT Connection Manager, which reads the Simulink Model hierarchically and allows to select signals (for indicators) and parameters (for controls).
All of these steps are explained in the PDF.
There are, however, some caveats: As the SIT "take control" of the Indicators mapped to Simulink signals (i.e. insert them in a special WHILE LOOP), you should use "Local Variables" to link them in your owns While Loops (if any). On the other side, if you want to "write" programatically to any Control maped to SImulink's model parameter, you should use Property Nodes (Value Signaling).
Well pippo2tan, you now have some to play with! Please ask me for any problem. I'm very glad to help you.
Cheers
Gaspar
01-18-2011 09:09 PM
Thanks for all the replies and helps. I have been having other problems in project and decided to postpone this issue. I will update again after trying these suggestions. Thanks..
01-18-2011 09:37 PM
I've seen others mention it but I would strongly consider TCP/IP as your solution. It's relatively easy to figure out and a great way to transfer data between two programs running on the same computer or over the network/internet. There are other solutions as well but learning to use TCP/IP will pay for itself many times over.
10-25-2015 08:49 AM
hi i want send x value to matlab , i dont know how to use matlab script and in matlab how call x ? please help me if u can