Thread Subject: "Axes" is slow! And now?

Subject: "Axes" is slow! And now?

From: Volker Klink

Date: 7 Sep, 2009 08:22:03

Message: 1 of 3

Hi everyone!

I'm trying to animate a videoimage synchronized with a plot. Therefore I use the timer function to call this little program:

axes(VideoWindowHandle);
    set(VideoImageHandle,'CData',FrameInput(i).cdata)
    drawnow;

axes(SignalWindowHandle(1));
    set(LineHandle(1),'XData',[i i]);

axes(SignalWindowHandle(2));
    set(LineHandle(2),'XData',[i i]);

This function does nothing more to select the subplots wihtin my figure and updates the content of each subplot. I already played around with several techniques to speed up the whole thing (e.g. "EraseMode none", constant image size, etc.). I'm aiming at at least 25 FPS which is hard to realize the more graphs are plotted.
I used the profiler and found out that the "axes" command to select the axes actually consumes most of the time.

Here's the result of the profiler:

axes(VideoWindowHandle) ---> 42.7%
axes(SignalWindowHandle(2)); ---> 41.2%
set(VideoImageHandle,'CData',F... --->11.5%
drawnow; --->1.5%
axes(SignalWindowHandle(1)); --->1.4%
All other lines ---> 1.7%

Anyone has an idea why two calls of "axes" consume so much time? Also I don't understand why two calls of axes are so slow while selecting SignalWindowHandle(1) is a lot faster...

Thanks a lot
Volker

Subject: "Axes" is slow! And now?

From: qooroo

Date: 7 Sep, 2009 09:16:03

Message: 2 of 3

"Volker Klink" <klinkv.NOSPAM@yahoo.de> wrote in message <h82frb$c42$1@fred.mathworks.com>...
> Hi everyone!
>
> I'm trying to animate a videoimage synchronized with a plot. Therefore I use the timer function to call this little program:
>
> axes(VideoWindowHandle);
> set(VideoImageHandle,'CData',FrameInput(i).cdata)
> drawnow;
>
> axes(SignalWindowHandle(1));
> set(LineHandle(1),'XData',[i i]);
>
> axes(SignalWindowHandle(2));
> set(LineHandle(2),'XData',[i i]);
>

the axes calls seem to be redundant - why do you need them?

your set functions take handles already and as far as I know drawnow updates every figure. try getting rid of your axes(windowhandle) calls and call drawnow after all your set commands.

-qooroo

Subject: "Axes" is slow! And now?

From: Volker Klink

Date: 7 Sep, 2009 11:31:03

Message: 3 of 3


> the axes calls seem to be redundant - why do you need them?
>
> your set functions take handles already and as far as I know drawnow updates every figure. try getting rid of your axes(windowhandle) calls and call drawnow after all your set commands.


Thanks a lot! The "axes" command were really redundant! It was sufficient to use the line and image handles! I can now display 3 animated plots and a video with up to 30 FPS! That should be fine!

I still call "drawnow" right after updating the video image...this gives me the best FPS. I have no clue why...but it does.

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
axes speed prof... Volker Klink 7 Sep, 2009 04:24:02
rssFeed for this Thread

Contact us at files@mathworks.com