LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variable outside for loop

 

How do I get a variable (integer) outside a for loop that is changed within the for loop?

 

0 Kudos
Message 1 of 6
(2,512 Views)

Hi,

 

 I could see your Vi as i am using 8.5 still. Just connect the variable inside the loop thriugh wire or use local variables.Pls send your code in the previous version.

Message Edited by AutoTEC on 10-17-2008 06:19 AM
0 Kudos
Message 2 of 6
(2,502 Views)

 

 

 I have the code in this way: 

 forloop

 

I added also the VI for the previous verson. I want to store the output in Y outside of the forloop.

0 Kudos
Message 3 of 6
(2,494 Views)

Hi,

 

          You have disable the auto-indexing and i have shown the difference in the attached VI.

http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/auto_indexing_1/ This gives more info. Hope the VI helps.

Message 4 of 6
(2,481 Views)

Also, if you want to see the new value with each iteration, then you obviously need to place the indicator inside the for-loop. Although, since the for-loop will run very fast, you're not likely to see each new value unless you run the code in highlight mode.

 

To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

0 Kudos
Message 5 of 6
(2,448 Views)
What I don't understand is why the for loop at all? You've got x+n-1
0 Kudos
Message 6 of 6
(2,445 Views)