LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialize differently with highlight execution

Hi everybody,

 

I found that I got different results when highlighting execution or not, quite strange.

 

As the VI attached below, I try to use the "index" got from the last time to adjust the starting point of the sine signal inside the loops, but I need to initialize it to 0 when finishing the for loop and running the program once again, so I put an initialize invoke node outside of the for loop.

 

However, say, now I change the value of the "index" indicator to 20 and run the program, the local variable isn't initialized to 0, and the signal doesn't begin from 20.17v. While when I turn on the highlight execution, It indeed displays initialize to 0 and the signal begins from 20.17v properly...

 

I feel quite confused why the VI runs differently when I turn on the highlight execution or not. Is it related to the time delay or something? Need your help!

 

Thanks a lot! : )

0 Kudos
Message 1 of 4
(2,674 Views)

Your problem is related to the dataflow. There is nothing in your vi to insure that the initialisation will be done before you enter the for loop. The prefered way is to use the error wire to connect the error in/error out input/output of the various subVIs/property nodes ...

 

Ben64

0 Kudos
Message 2 of 4
(2,665 Views)

Ok, I see. So what if I put the initialize nodes into a sequence before the loops' ?

 

0 Kudos
Message 3 of 4
(2,660 Views)

@cun wrote:

Ok, I see. So what if I put the initialize nodes into a sequence before the loops' ?

 


Not the best way to do it but that should work.

 

Ben64

0 Kudos
Message 4 of 4
(2,656 Views)