How to use compiled mexw64 functions in User defined Simulink blocks

7 ビュー (過去 30 日間)
Lukas Abelt
Lukas Abelt 2017 年 6 月 2 日
回答済み: Don Zheng 2017 年 6 月 8 日
Hello everyone,
For my current project I am working on I need to transfer data between multiple Simulink instances running on individual PC's. The connection will be established using a TCP Connection. As the existing Receive/Transmit blocks only act as clients I need to implement Server functionality. Simulink itself (sadly) does not offer this capability. I am now trying to use this toolbox that (with some tweaks to make it compatible) seems to work fine for matlab. When I use it in the matlab command window it works just fine. Now I wanted to implement this into my Simulink model. I tried to call the pnet methods (for example
socket=pnet('tcpsocket',25000)
)the toolbox provides within a System Object but as the toolbox compiles to a mexw64 file I couldn't get it to work.
Now I wanted to ask if there would be any way to use this Toolbox in a system object or if I Need to use another approach (Matlab S-function?). Or, even better, if someone had a reliable, working, solution for TCP Server functionality in Simulink (I know about the workaround using echotcpip but I cannot use it for this case) Thanks in advance
Lukas
  1 件のコメント
Navan Ruthramoorthy
Navan Ruthramoorthy 2017 年 6 月 5 日
If you need only simulation take a look at coder.extrinsic function.

サインインしてコメントする。

回答 (1 件)

Don Zheng
Don Zheng 2017 年 6 月 8 日
coder.extrinsic should work for simulation and also remember to initialize some outputs from the MEX function.

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by