Receiving information with TCPIP object
Show older comments
Greetings, I have written a script to receive an array of numbers from another computer with a TCPIP object, I'm doing so with an event function handler. Here's my code:
t = tcpip('0.0.0.0',30000,'NetworkRole','server');
t.BytesAvailableFcnCount = 20;
t.BytesAvailableFcnMode = 'byte';
t.BytesAvailableFcn = @received;
fopen(t)
and here's the "received" function:
function X=received(t,A)
X=fread(t,t.bytesavailable/4,'float')
end
The information is received without errors, but for some reason the number array I receive is not stored in the "X" variable or anywhere, I have no idea what the problem could be. Can any of you help me with this issue?
Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!