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:31:02 +0000 (UTC)
Organization: Simrad AS
Lines: 58
Message-ID: <g57g9m$ap5$1@fred.mathworks.com>
References: <g4gl79$e9t$1@fred.mathworks.com> <g4gnm6$cnk$1@canopus.cc.umanitoba.ca>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1215775862 11045 172.30.248.37 (11 Jul 2008 11:31:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 11 Jul 2008 11:31:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1411056
Xref: news.mathworks.com comp.soft-sys.matlab:478825


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