<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255230</link>
    <title>MATLAB Central Newsreader - Serial fscanf timeout with Guide GUI</title>
    <description>Feed for thread: Serial fscanf timeout with Guide GUI</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 03 Jul 2009 00:07:01 -0400</pubDate>
      <title>Serial fscanf timeout with Guide GUI</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255230#662405</link>
      <author>Camron Call</author>
      <description>I have a couple of things I am trying to fix:&lt;br&gt;
&lt;br&gt;
1 - &lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
2- &lt;br&gt;
&lt;br&gt;
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?&lt;br&gt;
&lt;br&gt;
I am thankful for any suggestions.  Thanks</description>
    </item>
    <item>
      <pubDate>Mon, 06 Jul 2009 12:36:37 -0400</pubDate>
      <title>Re: Serial fscanf timeout with Guide GUI</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255230#662871</link>
      <author>Trent Jarvi</author>
      <description>&lt;br&gt;
&quot;Camron Call&quot; &amp;lt;camroncall@gmail.cam&amp;gt; wrote in message &lt;br&gt;
news:h2ji35$5if$1@fred.mathworks.com...&lt;br&gt;
&amp;gt;I have a couple of things I am trying to fix:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 1 -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am working on handling the timeout when no data is received from the &lt;br&gt;
&amp;gt; serial port.  I am using a GUI to format and plot data from the serial &lt;br&gt;
&amp;gt; port. When no data is received from the serial port, the warning that the &lt;br&gt;
&amp;gt; timeout occurred shows in the command window and the script continues only &lt;br&gt;
&amp;gt; to find that I obviously have no data to work with.    What is the best &lt;br&gt;
&amp;gt; way to handle the warning?  I would like to have it close the serial &lt;br&gt;
&amp;gt; object and go back to my GUI with no issues.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 2-&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I currently am using fscanf to read the data with a timeout of 30 seconds. &lt;br&gt;
&amp;gt; I need to do this because I need to wait for a human to decide to press &lt;br&gt;
&amp;gt; the upload key on the instrument I am using (some people are a little &lt;br&gt;
&amp;gt; slow).  However, I would like to not have to wait that long if they &lt;br&gt;
&amp;gt; pressed the 'Download Data' button in my GUI by accident.  Can I make a &lt;br&gt;
&amp;gt; cancel button to stop the waiting?  What commands would cancel the fscanf &lt;br&gt;
&amp;gt; before any data was received or the timeout occurred?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am thankful for any suggestions.  Thanks&lt;br&gt;
&lt;br&gt;
Hi Camron,&lt;br&gt;
&lt;br&gt;
Rather than waiting for FSCANF to timeout and handle the errors, I'd suggest &lt;br&gt;
looking at the Serial BytesAvailable property and deciding if you want to &lt;br&gt;
read.  That gives you more control over what to do in the GUI. </description>
    </item>
  </channel>
</rss>

