Reading data into SIMULINK/MATLAB over UDP
3 ビュー (過去 30 日間)
古いコメントを表示
I am trying to read data into my SIMULINK model using the UDP receive block in the Instrument Control Blockset (I have also tried the UDP block from the Signal Processing Blockset). Within my local network, I have a device that is broadcasting data over the network using UDP protocol. I believe that I have entered all the parameters in the UDP block correctly and yet MATLAB does not seem to be able to communicate with the device. I have also tried using the tmtool in Matlab with a similar result. I created an interface object for the device and tried receiving data while it was broadcasting but I still do not receive any data. I have performed the following checks: 1) I pinged the IP of the device from the computer where MATLAB and it responds fine 2) Using wireshark, I could see that the device was broadcasting the data.
If you go to the URL below, you can see a snapshot from Wireshark. It shows the destination IP (set up for broadcast), the source IP, and the port numbers.
Can someone help configure the SIMULINK blocks (or the tmtool in MATLAB) so that I can receive the data being broadcast?
Thank you very much for your help.
Juri
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145238/image.png)
0 件のコメント
採用された回答
Andres
2011 年 8 月 3 日
If your network configuration works fine and you are sure of it you should check your data configuration
The data type that you had choose is really significat when getting a correct output. Make sure that both data types match and also check the endian type chose (better try Littel Endian frist)
0 件のコメント
その他の回答 (1 件)
Arnaud Miege
2011 年 4 月 5 日
If creating a UDP object in MATLAB does not work, then it's no surprise that the Simulink approach does not work either.
What are the settings of the UDP Receive block? Have you tried clicking on the button " Verify address and port connectivity "? Does it work?
HTH,
Arnaud
2 件のコメント
Arnaud Miege
2011 年 4 月 18 日
Yes, I saw the snapshot, but that doesn't tell me much. It would be much more useful to know how the blocks are configured and what you get when you try "verify address and port connectivity" in the UDP Receive block. You can probably leave the local port to -1 (automatic) and the port needs to match what's on the host you're connecting to. Is the data encoded in any way, does it need to be decoded? You can also look at what's coming out of the status output.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!