| Re: how to check if a loop fails [message #66260 is a reply to message #66259] |
Sun, 26 April 2009 12:36   |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Apr 26, 11:21 am, xiao <littledd...@gmail.com> wrote:
> hmm.....David, I tried the processbar like this:
>
> for j=0,7 do begin
>
> progressBar = Obj_New("SHOWPROGRESS", /AutoUpDate, Delay=5,
> Steps=20)
> progressBar->Start
> Obj_Destroy, progressBar
>
> .......
>
> endfor
>
> And it does move for the first step but it disappeared after that.
> Sigh.....
>
> Xiao
>
> On Apr 26, 10:49 am, David Fanning <n...@dfanning.com> wrote:
>
>> xiao writes:
>>> I have a loop including several functions and when I run the
>>> program, I wait for a long time and the loop is still running. I
>>> wonder if the loop is already dead. Any ideas how I can check it?
>
>> Checking for error messages comes to mind. :-)
>
>> You could also try a progress bar. It it doesn't move for
>> 5 or 10 minutes you might conclude your loop was dead:
>
>> http://www.dfanning.com/widget_tips/show_progress.html
>
>> Cheers,
>
>> David
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>
progressBar = Obj_New("SHOWPROGRESS", /AutoUpDate, Delay=5,Steps=20)
progressBar->Start
for j=0,7 do begin
.......
endfor
Obj_Destroy, progressBar
But even easier would be to:
1- step through the code using the debugger
2- add print statements to inspect variables
for j=0,n-1 do begin
print, 'Step ' + strtrim(j+1,2) + ' of ' + strtrim(n,2) + ' steps'
.......
endfor
|
|
|
|