Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to stop graphics refresh
Date: Fri, 11 Jul 2008 11:43:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 64
Message-ID: <g57h06$g3s$1@fred.mathworks.com>
References: <g4gl79$e9t$1@fred.mathworks.com> <g4gnm6$cnk$1@canopus.cc.umanitoba.ca> <g57g9m$ap5$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1215776582 16508 172.30.248.38 (11 Jul 2008 11:43:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 11 Jul 2008 11:43:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:478826


"Aleks " <aleksve@hotmail.com> wrote in message
<g57g9m$ap5$1@fred.mathworks.com>...
> If only it was that good... The figure always has to be 
> visible as it is part of an animation. I am becoming more 
> and more convinced that the error lies somewhere else. I 
> tested it with following one-liner:
> 
> i = 0:0.01:2*pi; h = plot(sin(i)); drawnow; while(true), 
> for j = 0:0.01:2*pi; set(h, 'YData', sin(i-j));  end; end
> 
> If the figure updated itself without explicit call to 
> drawnow, the line would produce a running sinus wave. 
> However, the figure updates itself only once, when the 
> first sinus is drawn. On the other hand, 
> 
> i = 0:0.01:2*pi; h = plot(sin(i)); drawnow; while(true), 
> for j = 0:0.01:2*pi; set(h, 'YData', sin(i-j));  drawnow; 
> end; end
> 
> (added "drawnow" just before "end; end") successfully 
> produces a running sinus wave.
> 
> Well, thanks for your time anyway :=)
> 
> best regards, Aleksander
> 
> 
> 
> roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in 
> message <g4gnm6$cnk$1@canopus.cc.umanitoba.ca>...
> > In article <g4gl79$e9t$1@fred.mathworks.com>,
> > Aleks  <aleksve@hotmail.com> wrote:
> > >Does anyone know if there is a way to stop refreshing 
> > >graphics in matlab? I have a quite complex graphics 
> > >program, and it looks like the figure sometimes updates 
> > >between calls to drawnow. It makes the image flicker.
> > 
> > Does the figure need to be visible during the update? 
> > I guess if flickering is a problem then Yes, but if it 
> doesn't
> > happen to need to be visible during the update, set the 
> figure
> > visibility off, do the update, and then set the figure 
> visibility
> > on.
> > 
> > If the figure does need to be visible, then you could do 
> a double-figure
> > process: when you want to do the update, create an 
> invisible figure,
> > do all the graphics writing to it, and when it is done, 
> make the
> > new figure visible and the old figure invisible.
> > 
> > -- 
> >   "To burn always with this hard, gem-like flame, to 
> maintain this
> >   ecstasy, is success in life."               -- Walter 
> Pater
> 

Try to set the doublebuffer property to on.

Jos