취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

A For loop structure executing the wrong number of times

Has anyone had any trouble with a for loop executing the wrong number of
times?

I have a for loop in which is nested another for loop.

The outermost loop always executes 4 times, regardless of what is wired
to the 'N'

If anyone has seen such a bug I'd be interested to know about it.

Seb

--
Sebastian James
IRC in Superconductivity
Madingley Road
Cambridge, CB3 0HE, UK
work: +44 (0)1223 337040
home: +44 (0)1223 526107
fax: +44 (0)1223 337074
email: ssj20@cam.ac.uk
0 포인트
1/3 메시지
3,393 조회수
Seb James wrote:
> Has anyone had any trouble with a for loop executing the wrong number of
> times?

> I have a for loop in which is nested another for loop.

> The outermost loop always executes 4 times, regardless of what is wired
> to the 'N'

> If anyone has seen such a bug I'd be interested to know about it.

You're not trying to auto-index an array are you ? If you have an
array input into the for loop and keep auto-index on, then the for
loop will run the lesser of the array size or the N.
--
******************************************************************************
Gavin Burnell Dept. Materials Science and Metallurgy
Device Materials Group University of Cambridge, UK
**********************************************
********************************
The good Christian should beware of mathematicians, astrologers and
all those who make empty prophecies. The danger already exists that
the mathematicians have made a covenant with the devil to darken the
spirit and to confine man to the bonds of Hell.
(St. Augustine of Hippo)
--
Gavin Burnell
Condensed Matter Physics Group, University of Leeds, UK
http://www.stoner.leeds.ac.uk/
0 포인트
2/3 메시지
3,393 조회수
It sounds like you have an array wired into your for loop set to auto
index. If this is the case, then the loop won't execute more times
than the number of elements in your array (you can wire it to loop less
times however).

To work around this disable indexing in the node at the point where the
array enters the loop (assuming that you don't know this already).
Then, use the "index array" funtion along with the loops iteration
terminal to increment the array.

I hope this helps.

eric

In article <37FDFB39.AF689AB1@cam.ac.uk>,
Seb James wrote:
> Has anyone had any trouble with a for loop executing the wrong number
of
> times?
>
> I have a for loop in which is nested another for loop.
>
> The outermost loop always executes 4 times, regardless of what is
wi
red
> to the 'N'
>
> If anyone has seen such a bug I'd be interested to know about it.
>
> Seb
>
> --
> Sebastian James
> IRC in Superconductivity
> Madingley Road
> Cambridge, CB3 0HE, UK
> work: +44 (0)1223 337040
> home: +44 (0)1223 526107
> fax: +44 (0)1223 337074
> email: ssj20@cam.ac.uk
>


Sent via Deja.com http://www.deja.com/
Before you buy.
3/3 메시지
3,393 조회수