LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get iteration value of the for loop outside the loop

Hi,
 
I would like to get the Iteration value of the FOR loop outside the FOR loop. This is because I want to tab the iteration value for the purpose of moving from one array value to another as I want to enable user to change the Delay value.  Therefore I've come out with the idea of taking the [ frequency / (user input) Delay ] to change the delay time. Is there any way for me to tab the iteration value??
 
Thanks..
Download All
0 Kudos
Message 1 of 7
(2,874 Views)

Hi arien,

you can use a queue to do that.

Mike

0 Kudos
Message 2 of 7
(2,858 Views)
Hi Mike,
 
Thanks for replying. I am quite new in Labview, not so familiar with queue. Could you elaborate more about it on how to implement it on my vi. thanks Mike
0 Kudos
Message 3 of 7
(2,851 Views)

Hi arien,

to learn something about queues, use the examle finder and search for "Queues". There are a lot of examples about it.

Mike

0 Kudos
Message 4 of 7
(2,841 Views)
A queue is probably overkill. You need to better explain what it is that you're trying to do, as I don't understand what it means to "tab the iteration value", and looking at your code didn't make that any clearer.

Actually, your VI didn't seem too clear either. You seem to be looping 32 times, which presumably is all the channels. Well, you can auto-index the loop to do that, so you don't need to wire a fixed value to N. An alternative is to set up the DAQ to read all the channels and get yourself a 2D waveform. Also, there's no point in reading the same file 32 times.


Message Edited by smercurio_fc on 03-17-2008 12:20 PM
0 Kudos
Message 5 of 7
(2,814 Views)
Hi Arien,

In case you still want to learn how queue works
Please take a look at my example code




Message Edited by Van_L on 03-17-2008 03:25 PM
Van L
NI Applications Engineer
0 Kudos
Message 6 of 7
(2,798 Views)
Here is a way to do it with an indicator and a local variable.  Beware of race conditions.  See the comment in the block diagram.  In this case, you are reading the local 100mS after it is written.  Without the timing, there is no guarantee that the read won't happen before the write, in which case you would get the wrong data.  This is why people don't like local or global variables.  But with proper care, they can be made to work for you.
- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 7
(2,791 Views)