LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How I can pass Value out of cycle?

I have a while loop and a random numbers produced in this loop.

I desire to take a value of this loop and use it in an other loop.

It's possible? When I do it I fall in error because I can't pass number out of the cycle. I don't want to do a vector, I desire only use the number of every loops, but out of cycle. Can U show me how I can do?

Message Edited by Michelle1892773 on 02-15-2010 04:54 PM
0 Kudos
Message 1 of 6
(2,646 Views)

You say vector, but do you mean array?

 

When you say "cycle", do you mean loop?

 

The best way to pass a value out of a loop to be used elsewhere is to use a queue.  In LabVIEW, go to File, New.... and Producer/consumer loops (data) for an example.

0 Kudos
Message 2 of 6
(2,626 Views)

Hello Michelle,

 

There are different ways to pass data according to your idea.

In this way i figure out that you should use Local Variables. Don't abuse of this technique of communicating between multiples loops. Keep in mind that this methods are very useful but could give a lot of problems if don't managed as needed.

Please refer to the following developer zone example to better undestand.

 

Passing Information using Local Variable for Two While Loops

 

Let me know if yo need additional assistance.

Kind regards

 

 

Matteo
0 Kudos
Message 3 of 6
(2,603 Views)

Here is a very quick example.

 

They can get much more complicated depending on what you eventually need to do.

Tim
GHSP
0 Kudos
Message 4 of 6
(2,595 Views)

Imagine to have a cycle for, in which there is a random number icon and in this cycle I can multiply this number for 10, 100. But to choose the multiplier I must save in an array 2 subsequently numbers, add this 2 numbers and after if the result is much of 1 I multiply for 100, if is minus than 1 I multiply to 100.

I must to use two subsequently numbers of for cycle so I can use the same for cycle. But I must also choose the multiplier of the third number of cycle: so the result must be given inside the cycle. There is a problem, for me, to pass every number of cycle out of thisand after pass thegood multiplier inside the cycle. How can do it? Can u do a simple Vi that do this?

Thanks.

0 Kudos
Message 5 of 6
(2,571 Views)
If I understand you this example should be close to what you are asking for.
Tim
GHSP
0 Kudos
Message 6 of 6
(2,551 Views)