I have a very simple problem: I am trying to get a callback function to execute after receiving data through a tcp/ip connection. I have been reading the asynchronuous writing and reading section of the MATLAB documentation here, and I am essentially reproducing what they suggest without any success.
Here is a simple script which illustrates my issue, when I execute it, I get a series of error and warning messages:
t = tcpip('127.0.0.1',4000);
t.BytesAvailableFcn = 'dispcallback';
fprintf(t, 'Test 123');
When I run the above script, I get these messages:
Error using dispcallback (line 13)
Not enough input arguments.
Error in instrcb (line 20)
Warning: The BytesAvailableFcn is being disabled. To enable the callback property
either connect to the hardware with FOPEN or set the BytesAvailableFcn property.
Why is this? How can I properly invoke the callback function? I have tried with MATLAB 2014b and 2015b with the same result.