For a Udp connection, while loop does not work. Code gives no error.
이전 댓글 표시
I am extratcing data from a file and receiving it on matlab via udp connection. I have written doen a code which works perfectly fine when I run it step by step. BUt when I run it as a whole while loop doesn't seem to work. Here is the code:
port=50021;
smartmeter = smartHES(port);
smartmeter.InitiateSocket();
dataAmount=0;
dataHistory=[];
pause(0.1)
byteav=smartmeter.smart.BytesAvailable;
while byteav
[smt]=smartmeter.readDATA();
dataHistory=[dataHistory smt];
fprintf('data is being read on port %d amount now %d\n',port,dataAmount);
end
What should I do to get this code running by just pressing run button. Further I will use this code for several ports using spmd.
댓글 수: 5
Walter Roberson
2021년 6월 15일
편집: Walter Roberson
2021년 6월 15일
you do not update, byteav in your loop, or dataAmount
Asma Farooq
2021년 6월 15일
Asma Farooq
2021년 6월 15일
Walter Roberson
2021년 6월 15일
you still do not update byteav
Asma Farooq
2021년 6월 17일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Parallel Computing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!