Path: news.mathworks.com!not-for-mail
From: "tkeil " <tlkeil@vradc.com>
Newsgroups: comp.soft-sys.matlab
Subject: serial port and figure window
Date: Tue, 4 Mar 2008 18:30:21 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <fqk4ft$l39$1@fred.mathworks.com>
Reply-To: "tkeil " <tlkeil@vradc.com>
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 1204655421 21609 172.30.248.38 (4 Mar 2008 18:30:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Mar 2008 18:30:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1168368
Xref: news.mathworks.com comp.soft-sys.matlab:455349


Hi, I am trying to write code that will display an image in 
a figure window until the viewer pushes a button on a 
button box connected through a serial port. 

I have tried using fread(obj,1) after the image is 
displayed in the figure window. This works, but only if I 
insert pauses in my code or step through using the 
debugger. When I let the code run without pausing, the 
image is not displayed in the figure window but the system 
is waiting for a response from the button box. This is odd 
because the code is written so the image should appear in 
the figure window BEFORE ever executing the fread command. 

I have also tried doing this asynchronously without 
success. When using the 'BytesAvailableFcn' approach, I'm 
not sure how I can get the image to display up until the 
callback function is called. Also, can you return values to 
the original function when a callback function is called?

Please let me know if anyone has any thoughts or ideas.

Thanks!