f



data display in MATLAB GUI

Hi, 

I am trying to stream data from a serial port to GUI and 
display it on a edit text box, I simply use Set() function 
to let the received data displayed in the edit box but 
found it is not successful, because the serial port is 
under continue reading and data change all the time.  
anyboy have this experience can give me some hints? Thanks 
for 10000000^-^ in advance!
0
jiasonliu (3)
3/20/2008 7:25:04 PM
comp.soft-sys.matlab 211266 articles. 17 followers. lunamoonmoon (258) is leader. Post Follow

6 Replies
480 Views

Similar Articles

[PageSpeed] 7

"JIAZHONG Liu" <jiasonliu@hotmail.com> wrote in message 
<frudmg$1bj$1@fred.mathworks.com>...
> Hi, 
> 
> I am trying to stream data from a serial port to GUI and 
> display it on a edit text box, I simply use Set() 
function 
> to let the received data displayed in the edit box but 
> found it is not successful, because the serial port is 
> under continue reading and data change all the time.  
> anyboy have this experience can give me some hints? 
Thanks 
> for 10000000^-^ in advance!

hi, guy, then have u found the way of solving ur prob?
i m doing a similiar gui, facing the same prob..
if u have found, could u send me the m file?
<odick85@yahoo.com>
thx a lot!!

0
odick85 (3)
3/31/2008 7:41:01 PM
In article <frudmg$1bj$1@fred.mathworks.com>,
JIAZHONG Liu <jiasonliu@hotmail.com> wrote:

>I am trying to stream data from a serial port to GUI and 
>display it on a edit text box, I simply use Set() function 
>to let the received data displayed in the edit box but 
>found it is not successful, because the serial port is 
>under continue reading and data change all the time.  
>anyboy have this experience can give me some hints?

What exactly do you want to appear in the edit box, and when?

Do you want every byte received to be placed at the end of the
edit box as the byte is received, so that the edit box keeps
growing to reflect everything received? If that's what you want
then you will run into the problem that updating the edit box is
relatively slow and if you want to stream your serial port
you cannot afford to add each new byte as it is received.

Updating after you had received (say) every 2000'th character
might be practical... but might not be either, as the box gets fuller.

Updating the box to only hold the -last- so many characters would
likely be faster, as then there would be a limit on how much internal
updating the edit box would have to do. (Remember, edit boxes do line
wrapping, which is affected by the proportional font active at the time.)

If you want do only display the -last- so many characters, using
a "circular buffer" would likely be best.

-- 
  "For men are prone to go it blind along the calf-paths of the
  mind To do what other men have done. They follow in the beaten
  track, and out and in, and forth and back, and still their
  devious course pursue, to keep the path that others do." -- Sam Walter Foss
0
roberson2 (8605)
4/1/2008 7:38:15 PM
Hi, I've got a problem with reading serial data into a GUI.

I've got a GUI with only 2 buttons: START and STOP.

After pressing 'start' program should start reading data 
from a serial port and plot it.
After pressing 'stop' the program should stop plotting.

The main problem is that I can't read data from the port 
inside the GUI, cause it does not see variables declared in 
the workspace. Making them global doesn't help at all.
All I can do is try to declare serial object and open it 
inside of the GUI *.m file but then I face another problem- 
t's a virtual (bluetooth) port and for some reason creating 
and opening it takes sometimes even over 30 seconds...

Could somebody write a simple way HOW to read data from 
serial port inside to the GUI enviroment?

Thanks for any suggestion
0
miqba (6)
5/6/2008 10:35:05 AM
In article <fvpc8p$j9l$1@fred.mathworks.com>,
Michal S <miqba@szczecin.home.pl> wrote:

>The main problem is that I can't read data from the port 
>inside the GUI, cause it does not see variables declared in 
>the workspace. Making them global doesn't help at all.

evalin(), assignin()

-- 
  "MAMA: Oh--So now it's life. Money is life. Once upon a time freedom
   used to be life--now it's money. I guess the world really do change.
   WALTER: No--it was always money, Mama. We just didn't know about it."
                                              -- Lorraine Hansberry
0
roberson2 (8605)
5/6/2008 4:07:17 PM
Thanks mate!
evalin() was exactly the kind of stuff I was looking for.

I owe you a beer ;)
0
miqba (6)
5/6/2008 5:01:07 PM
"Michal S" <miqba@szczecin.home.pl> wrote in message <fvq2sj$edm$1@fred.mathworks.com>...
> Thanks mate!
> evalin() was exactly the kind of stuff I was looking for.
> 
> I owe you a beer ;)


Hey dude, 
I know it is a long time, but how did you solve the problem? 
I am doing the same, and reading data from GPIB port, then I save it using assignin()

After pushing a button, I want to show my 100 current values in a Edit Text, so I use 

v = evalin('base', 'data'); % data is my variable name where the data is stored
set(handles.input1_editText,'String',v);

But the Edit Text is always empty... I tried to convert v tp string using 
v = str2num(v,'String');
but still same error..

I hope you have time to help.

regards
0
Mohammed
6/7/2010 11:55:20 AM
Reply: