Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Serial fscanf timeout with Guide GUI
Date: Fri, 3 Jul 2009 00:07:01 +0000 (UTC)
Organization: University of Utah
Lines: 11
Message-ID: <h2ji35$5if$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246579621 5711 172.30.248.38 (3 Jul 2009 00:07:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 3 Jul 2009 00:07:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 811741
Xref: news.mathworks.com comp.soft-sys.matlab:552580


I have a couple of things I am trying to fix:

1 - 

I am working on handling the timeout when no data is received from the serial port.  I am using a GUI to format and plot data from the serial port. When no data is received from the serial port, the warning that the timeout occurred shows in the command window and the script continues only to find that I obviously have no data to work with.    What is the best way to handle the warning?  I would like to have it close the serial object and go back to my GUI with no issues.

2- 

I currently am using fscanf to read the data with a timeout of 30 seconds.  I need to do this because I need to wait for a human to decide to press the upload key on the instrument I am using (some people are a little slow).  However, I would like to not have to wait that long if they pressed the 'Download Data' button in my GUI by accident.  Can I make a cancel button to stop the waiting?  What commands would cancel the fscanf before any data was received or the timeout occurred?

I am thankful for any suggestions.  Thanks