Re: number of iterations [message #68956] |
Sun, 06 December 2009 17:50 |
Wasit.Weather
Messages: 62 Registered: February 2008
|
Member |
|
|
On Dec 6, 7:37 pm, David Fanning <n...@dfanning.com> wrote:
> Elkunn writes:
>
> .
>
>> How can I do that in this example? I would like to have print the
>> number of iterations within that Repeat Loop.
>
>> Thanks
>> ;E1 = Unit vector, known
>> ; Z is known matrix
>> REPEAT BEGIN
>> EC = Z##E1
>> L = sqrt(EC[0]+EC[1])
>> E1 = EC/L
>> print,L
>> ;Keep going until nothing is moved.
>> ENDREP UNTIL L LT 1.2840277
>
> ;E1 = Unit vector, known
> ; Z is known matrix
> count = 0
> REPEAT BEGIN
> print, count++
> EC = Z##E1
> L = sqrt(EC[0]+EC[1])
> E1 = EC/L
> print,L
> ;Keep going until nothing is moved.
> ENDREP UNTIL L LT 1.2840277
>
> --
> 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.")
Wov!
Things are so simple, as long as you know how to do it!!!
thanks
|
|
|
Re: number of iterations [message #68957 is a reply to message #68956] |
Sun, 06 December 2009 17:37  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Elkunn writes:
.
> How can I do that in this example? I would like to have print the
> number of iterations within that Repeat Loop.
>
> Thanks
> ;E1 = Unit vector, known
> ; Z is known matrix
> REPEAT BEGIN
> EC = Z##E1
> L = sqrt(EC[0]+EC[1])
> E1 = EC/L
> print,L
> ;Keep going until nothing is moved.
> ENDREP UNTIL L LT 1.2840277
;E1 = Unit vector, known
; Z is known matrix
count = 0
REPEAT BEGIN
print, count++
EC = Z##E1
L = sqrt(EC[0]+EC[1])
E1 = EC/L
print,L
;Keep going until nothing is moved.
ENDREP UNTIL L LT 1.2840277
--
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.")
|
|
|
Re: number of iterations [message #68958 is a reply to message #68957] |
Sun, 06 December 2009 17:32  |
Wasit.Weather
Messages: 62 Registered: February 2008
|
Member |
|
|
On Dec 6, 6:49 pm, David Fanning <n...@dfanning.com> wrote:
> Elkunn writes:
>
> .
>
>> Is there a way to count the number of iterations in a Repeat.. Until
>> Loop?
>
> I suppose something like "count =+" would work. ;-)
>
> 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.")
How can I do that in this example? I would like to have print the
number of iterations within that Repeat Loop.
Thanks
;E1 = Unit vector, known
; Z is known matrix
REPEAT BEGIN
EC = Z##E1
L = sqrt(EC[0]+EC[1])
E1 = EC/L
print,L
;Keep going until nothing is moved.
ENDREP UNTIL L LT 1.2840277
|
|
|
Re: number of iterations [message #68960 is a reply to message #68958] |
Sun, 06 December 2009 16:49  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Elkunn writes:
.
> Is there a way to count the number of iterations in a Repeat.. Until
> Loop?
I suppose something like "count =+" would work. ;-)
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.")
|
|
|