How can I programmatically determine if a timeout has occured?

2 次查看(过去 30 天)
I'm using the "tpcip" function to create a tcp object. I then set paramters like buffer size and timeout length. Next I begin sending data messages from a LabVIEW program to Matlab. The code works in general but I've run into an issue with timing.
In my program I want to loop through reading incoming messages using "fscanf" and only pause until new data is available. I do NOT want to manually use a "pause()" function, I need this to run as fast as possbile. On the sender side (LabVIEW) I simply wait for a response after each data message that is a form of checksum (number of bytes recieved). When I get that checksum I send the next data message as soon as possible. On the reciever side (Matlab) I set an adaquate timeout and the program runs through each data message fast enough in this case up until it reaches the end of a data set. I would like the Matlab code to then go back around and wait for a new connection.
The problem is that I need to determine if this timeout has occured programmatically. Right now when a timeout occurs a warning is thrown and the Matlab program crashes. I need to instead check if a timeout has occured and depending on whether or not the "fscanf" has timed out then determine what to do next.
This is very simple to do in LabVIEW by simply wiring a case structure to the error data line. How can this be done in Matlab?
Thanks!
MZ

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 LabVIEW 的更多信息

产品


版本

R2013b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by