|
|
||||
|
||||
|
|
|
|||
|
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.") |
|
|||
|
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 |
|
|||
|
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.") |
|
|||
|
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 |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| flags for derivative sign c | http://alexslemonade.org | Newsgroup comp.lang.fortran | 1 | 10-28-2009 11:54 AM |
| flags for derivative sign c | http://alexslemonade.org | Newsgroup comp.lang.scheme | 1 | 10-28-2009 11:54 AM |
| Checking if a Mumps variable is a number or not? | David Hubball | Newsgroup comp.lang.mumps | 12 | 10-27-2009 11:14 PM |
| Treedisc Macro | Alex Murphy | Newsgroup comp.soft-sys.sas | 0 | 04-28-2009 07:04 AM |
| Lock requests not available due to conflicts? | Mark | Newsgroup comp.databases.berkeley-db | 0 | 04-18-2009 02:04 AM |