I am trying to receive sensor values of a Linux machine in realtime (or at least close to it) - so I wrote a C programm sending around 16.000 values/second to an UDP socket.
Now I am trying to read this data continuosly in MatLab and for that, I thought a DatagramReceivedFcn is the best approach.
But I am encountering a problem where I dont receive any more datagrams after around 10-20 (it just stops receiving them), although the server is sending many more datagrams to the socket.
Also I didn't find a way yet to store the received data for further processing (plotting, write it to a SQL database) as the data doesn't show up in the base workspace.
The Code I am currently testing with is the following:
u = udp('192.168.0.164', 8080);
u.InputBufferSize = 1024;
u.ReadAsyncMode = 'continuous';
u.DatagramReceivedFcn = @DatagramReceivedFcn;
u.DatagramTerminateMode = 'on';
u.Terminator = '!';
fprintf(u, 'Requesting Data')
datagram = fscanf(u);
Hope you can help me - thanks in advance!