Thread Subject: Most efficient way to continously update axes data in GUI

Subject: Most efficient way to continously update axes data in GUI

From: Dennis Nord

Date: 1 Jun, 2009 16:42:01

Message: 1 of 7

Hello!

I have 2 axes and a total of 5 line children in my GUI which i populate with data using set(linehandle,'[x/y]data',[myvalues])... calls using an eventlistener to a simulink object (scope). Im using realtime windows target for control design applications.

This solution working very well, although it seems to be very resource consuming (i would like to update my plot faster than 10 times per second which is the current max before gui gets delayed from my model!

What would the fastest way be to continously update my lines? Is there any way to append the lines rather than resetting the entire x/y vector values each time? Can i make some configurations to my GUI to speed things up?

Any suggestions would be very appreciated.

Dennis

Subject: Most efficient way to continously update axes data in GUI

From: Glen Rutledge

Date: 16 Jul, 2009 21:16:01

Message: 2 of 7

"Dennis Nord" <dennis.nord@gmail.com> wrote in message <h010cp$52a$1@fred.mathworks.com>...
> Hello!
>
> I have 2 axes and a total of 5 line children in my GUI which i populate with data using set(linehandle,'[x/y]data',[myvalues])... calls using an eventlistener to a simulink object (scope). Im using realtime windows target for control design applications.
>
> This solution working very well, although it seems to be very resource consuming (i would like to update my plot faster than 10 times per second which is the current max before gui gets delayed from my model!
>
> What would the fastest way be to continously update my lines? Is there any way to append the lines rather than resetting the entire x/y vector values each time? Can i make some configurations to my GUI to speed things up?
>
> Any suggestions would be very appreciated.
>
> Dennis

Hi Dennis. Interesting problem. I have been doing similar things lately. Have you tried changing the renderer for your figure? If you have openGL, this is often faster than the default. If hf is the handle for your GUI figure, then call set(hf,'Renderer','openGL') and see if that helps.

Glen

Subject: Most efficient way to continously update axes data in GUI

From: Glen Rutledge

Date: 16 Jul, 2009 21:17:17

Message: 3 of 7

"Dennis Nord" <dennis.nord@gmail.com> wrote in message <h010cp$52a$1@fred.mathworks.com>...
> Hello!
>
> I have 2 axes and a total of 5 line children in my GUI which i populate with data using set(linehandle,'[x/y]data',[myvalues])... calls using an eventlistener to a simulink object (scope). Im using realtime windows target for control design applications.
>
> This solution working very well, although it seems to be very resource consuming (i would like to update my plot faster than 10 times per second which is the current max before gui gets delayed from my model!
>
> What would the fastest way be to continously update my lines? Is there any way to append the lines rather than resetting the entire x/y vector values each time? Can i make some configurations to my GUI to speed things up?
>
> Any suggestions would be very appreciated.
>
> Dennis

Hi Dennis. Interesting problem. I have been doing similar things lately. Have you tried changing the renderer for your figure? If you have openGL, this is often faster than the default. If hf is the handle for your GUI figure, then call set(hf,'Renderer','openGL') and see if that helps.

Glen

Subject: Most efficient way to continously update axes data in GUI

From: sagar

Date: 17 Sep, 2009 19:55:19

Message: 4 of 7

Hi Glen, Dennis,
    I am doing something similar. I have an axes object, and am plotting 4 fixed circles and one with increasing radius. Its like a ripple going out... and some fixed circles... and once the ripple reaches the edge, it finishes one iteration...then it will start again from the center... and it will keep on going in an infinite loop...

but it seems that by default my system takes the renderer to be "painters"... and in this case, the speed of the simulation is good for the first two iterations...but after that it really slows down...

i tried using OpenGL, but the simulation slows down from the first iteration itself, and it is worse than using "painters"...

I am not sure if any of you faced a similar problem...

-Sagar

"Glen Rutledge" <grutledg@shaw.ca> wrote in message <h3o5ct$5gc$1@fred.mathworks.com>...
> "Dennis Nord" <dennis.nord@gmail.com> wrote in message <h010cp$52a$1@fred.mathworks.com>...
> > Hello!
> >
> > I have 2 axes and a total of 5 line children in my GUI which i populate with data using set(linehandle,'[x/y]data',[myvalues])... calls using an eventlistener to a simulink object (scope). Im using realtime windows target for control design applications.
> >
> > This solution working very well, although it seems to be very resource consuming (i would like to update my plot faster than 10 times per second which is the current max before gui gets delayed from my model!
> >
> > What would the fastest way be to continously update my lines? Is there any way to append the lines rather than resetting the entire x/y vector values each time? Can i make some configurations to my GUI to speed things up?
> >
> > Any suggestions would be very appreciated.
> >
> > Dennis
>
> Hi Dennis. Interesting problem. I have been doing similar things lately. Have you tried changing the renderer for your figure? If you have openGL, this is often faster than the default. If hf is the handle for your GUI figure, then call set(hf,'Renderer','openGL') and see if that helps.
>
> Glen

Subject: Most efficient way to continously update axes data in GUI

From: Rodney Thomson

Date: 18 Sep, 2009 03:55:04

Message: 5 of 7

Try playing around with the line's 'EraseMode' property.

By default it redraws the entire frame. Setting it to perhaps 'xor' might speed it up significantly.

Subject: Most efficient way to continously update axes data in GUI

From: Rodney Thomson

Date: 18 Sep, 2009 05:29:18

Message: 6 of 7

Oh, and run the MATLAB Profiler, see if you can narrow down exactly where the time is being spent.

Subject: Most efficient way to continously update axes data in GUI

From: Ralph Schleicher

Date: 18 Sep, 2009 20:16:03

Message: 7 of 7

"Rodney Thomson" <readmore@iheartmatlab.blogspot.com> writes:

> Try playing around with the line's 'EraseMode' property.
>
> By default it redraws the entire frame. Setting it to perhaps 'xor'
> might speed it up significantly.

The correct combination is important. If you set 'EraseMode' to
'normal' for the animated objects, set the figure's 'DoubleBuffer'
to 'on' and 'Renderer' to 'painters'. If you set 'EraseMode' to
'xor' for the animated objects, the figure's 'DoubleBuffer' has
to be 'off'.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui speed delay sagar 17 Sep, 2009 15:59:07
gui Glen Rutledge 16 Jul, 2009 17:19:08
renderer Glen Rutledge 16 Jul, 2009 17:19:08
simulink Dennis Nord 1 Jun, 2009 12:44:05
gui Dennis Nord 1 Jun, 2009 12:44:05
line Dennis Nord 1 Jun, 2009 12:44:05
realtime window... Dennis Nord 1 Jun, 2009 12:44:05
rtwin Dennis Nord 1 Jun, 2009 12:44:05
update Dennis Nord 1 Jun, 2009 12:44:05
axes Dennis Nord 1 Jun, 2009 12:44:05
efficient Dennis Nord 1 Jun, 2009 12:44:05
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com