Recieve udp data
Answer
11/8/18 4:38 PM

Hello, 

I'm trying to understand the udp-example and read the data in Matlab. In the xdk-code I entered the IP of my computer and the port 55056. If I create a udp object in Matlab with these properties and try "fopen" and "fscanf", I don't get any values. 

Is this a problem with Matlab or am I doing something wrong with the xdk?

Kind regards,
Johannes

0 (0 Votes)
RE: Recieve udp data
Answer
11/9/18 3:49 PM as a reply to Johannes Kaiser.
Dear Johannes,

Please note that you would need to be in the same Wi-Fi network, that the XDK is able to reach your laptop when posing as UDP server.

In regards to your Matlab UDP object, could you please go more into detail, what the functions fopen and fscanf do? Are these manipulating received data or are the requesting data on the XDK side via UDP?

Additionally, please note that Matlab might require a certain sending format, which you need to implement on the XDK side to make the data transfer work.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: Recieve udp data
Answer
11/15/18 11:44 AM as a reply to Franjo Stjepandic.

Dear Franjo, 

I know, that I need to be in the same Wi-Fi network and I'm sure, I am.

If I create a UDP object with u=udp('RemoteHost', RemotePort), which is my PC's IP and the port 55056, I can connect the object to the host with fopen(u).

According to  mathworks homepage, " A = fscanf(obj) reads data from the instrument connected to obj, and returns it to A. The data is converted to text using the %c format."

I can check, if data is available with u.BytesAvailable, but this is always 0. I dont't know, why that happens. 

Is there an othe way to recieve, display and store the upd-Data from the xdk on my PC?

 

Kind regards,
Johannes

0 (0 Votes)