Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / MATLAB / July 2008



Tip: Looking for answers? Try searching our database.

figure display

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Theresa - 30 Jul 2008 21:46 GMT
Hi,

I would like to update and display a figure as I do
calculations in a loop.  For example:

t = 0:1:100;

while flag < 0
     %Do some calculations to generate x
     
     %Print a figure to show how the calculations are    
      progressing
     figure('Name', 'Diagnostics')
     plot(t,x)
     drawnow

     %Check to see if the while loop should be ended

end

Although the figure does update after each run through the
while loop, if I minimize the window then try to view it
again before the next update, I am unable to view the
figure.  Similarly, if I have the figure window minimized
during the update and then try to view it, I am unable to
view the figure.  Only if the figure window is in front of
all other windows I have open can I see the update.  

The calculations in the while loop take some time, so I am
doing other things while the program runs.  It is not
convenient for me to keep the figure window at the front of
my screen in order to see it update after each run through
the while loop.  I'd like to just periodically check it to
see how it looks.  Does anyone know why this is happening
and how I can keep the figure displayed all the time,
whether it was minimized or not during the update?  I hope
this makes sense and is clear.  

Any help would be great!
Thanks
Theresa
Walter Roberson - 31 Jul 2008 07:06 GMT
>I would like to update and display a figure as I do
>calculations in a loop.  For example:

>t = 0:1:100;

>while flag < 0
>      %Do some calculations to generate x
[quoted text clipped - 8 lines]
>
>end

>Although the figure does update after each run through the
>while loop, if I minimize the window then try to view it
[quoted text clipped - 3 lines]
>view the figure.  Only if the figure window is in front of
>all other windows I have open can I see the update.  

I think the only thing you can do is add calls to
drawnow('expose') into the calculations to reduce the time until
your figure gets redrawn. Redrawing is a non-trivial matlab
process, as it has to detect the portion of the screen that needs
to be redrawn and redraws just that part.

*Possibly* setting the figure to be double-buffered might help,
but I'm not convinced.
Signature

 "He wove a great web of knowledge, linking everything together,
 and sat modestly at a switchboard at the center, eager to help."
                                             -- Walter Kerr

Theresa - 31 Jul 2008 23:43 GMT
I did try that and it doesn't help...but I did discover
that if I dock the figure, then I can minimize and maximize
the Matlab window whenever I want and see the figure, even
if it's in the middle of the while loop.

Thanks for the reply!

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g6rkol$60v$1@canopus.cc.umanitoba.ca>...

> >I would like to update and display a figure as I do
> >calculations in a loop.  For example:
[quoted text clipped - 30 lines]
> *Possibly* setting the figure to be double-buffered might help,
> but I'm not convinced.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.