Receiving information with TCPIP object
显示 更早的评论
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?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!