LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have one while loop in another while loop

Is it?
0 Kudos
Message 1 of 17
(3,246 Views)
Of course it is possible. You could nest a lots of loops - it's just a matter of sense.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 17
(3,234 Views)
But when I do... (combine two) the index counter of the inner one does not change... remains 0 forever...
0 Kudos
Message 3 of 17
(3,229 Views)

This sounds strange. Could you post the vi? I assume you are trying to do something and have some code.

As always - without deeper knowledge of what you're trying to accomplish, it's not that easy to help.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 17
(3,226 Views)
If you are checking the index value using an indicator, it should be updated within the inner loop.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 17
(3,216 Views)
Ok, But I'am warning you... I'am a newbie.. so it may look a bit messy
 
Main problem is how I should save all my samples into an array. If I can do that it should be "finished" . Well all functions will be there...
 
Have made som tests to construct an array, the conditional disable structure by the blue text boxes in swedish should be deleted.
 
0 Kudos
Message 6 of 17
(3,211 Views)
If you're talking about the loop in the disable structure, you just made a mistake obviously. You wired the termination wire of the first loop to the terminal of the second loop (red line in the picture). So it stops execution after just one iteration.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 7 of 17
(3,207 Views)
That was just a stupid test. This is how i want it to be... in gap between unconnected wires there  should be a conversion to array format

Message Edited by Johan.svensson on 07-18-2006 07:18 AM

0 Kudos
Message 8 of 17
(3,205 Views)

Well, actually there are several possibilities:

1. You right click the orange square where the double value gets out of the loop and select "enable indexing". This results in an array of all values you get while this inner loop is running.

2. You add a shift register to the outermost loop and use the "build array" function after the inner while loop. This results in an array of the last value after the inner while loop has stopped.

3. You combine both ways described above. Then you get a 2D-array.

You can see this in the attached vi. In every case you have to be aware of what happens with the memory. In case 2 and 3 the array grows steadily. This could leed to problems, so you have to take care to empty it, if possible.

Now it depends on what kind of data you need.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 9 of 17
(3,193 Views)

Thanks!

Very good example!

Understand and got it to work... Just didn't think of that soloution...

0 Kudos
Message 10 of 17
(3,178 Views)