You can receive UDP broadcast data using the UDP functionality in Instrument Control Toolbox.
If you are only receiving UDP packets, and not sending out any UDP packets, the only relevant properties of the UDP object are LocalHost and LocalPort; the RemoteHost and RemotePort are not relevant in this case.
LocalHost is the host name or IP address of the Ethernet adapter you are receiving the UDP packets on, and the LocalPort is the port number you are receiving the UDP packets on.
Note: If you don't specify LocalHost (or if you set it to an empty string), you will receive UDP packets on all available Ethernet interfaces at the specified LocalPort.
u = udp('', 'LocalHost', '', 'LocalPort', 8000);
fopen(u);
packetData = fread(u);
fclose(u);
delete(u);
clear u
Best Answer