LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the elements out of a for loop simultaneously during the loop execution

Solved!
Go to solution

Hi, 

I am student. I would like to know how to get the counter values outside the For loop parallely while the loop runs rather that getting the finally value outside the For loop. Looking forward for answers.Smiley Happy

 

Thanks,

Athira

0 Kudos
Message 1 of 10
(3,153 Views)

Can you give a little more detail?  What count?  What is reading the values outside of the loop?  Do you have a VI you can show us what you are trying to do?

 

It almost sounds like you want to use a queue, but it is hard to say without more information.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,146 Views)

Hi

I am adding the SIMPLE screen shot of what i want.

Out side the loop iam getting either the final value  or as an array. I want each iteration outside the loop.

counter.jpg

thanks,

0 Kudos
Message 3 of 10
(3,136 Views)

You could use a notifier (since it is a single value) or a reference (with a property node) to a control that gets the value elsewhere in another VI.

If it is within the same VI, you could use a property node (right click > create > property node > value) from the control within the same VI located outside the loop.

 

If you promiss NOT to abuse the use of Local Variables, you could use that to only write from ONE location within the For Loop to a control outside the loop, similar to the property node mentionned earlier.  (Of course, I will be struct by lightening for mentionning that and scolded by other LabVIEW coders for having a change of heart on the use of Locals....  Shivers are already crawling up my spine).

 

You could use a queue, but that might be an overkill, unless:  the count is generated faster than it is being read elsewhere...

 

As crossrulz mentionned, can you describe what you will be doing with the count?  Because synchronizing data (fresh / stale / etc) is very important within LabVIEW as it executes based on dataflow rather than a sequential order.

 

Hope this helps. 

 

 

EDIT: 

You have not fully provided the answer.  We figured that much of your code from your description, but what is reading the value of the count?  Is it in a separate loop?  If not, it may only deal with the first value, which is likely 0.  The proper advice depends on how you process the received data (count).

 

 

0 Kudos
Message 4 of 10
(3,132 Views)

Hi,

I intend to read all the data of an array without loop.  

 

0 Kudos
Message 5 of 10
(3,120 Views)

@athiras wrote:

Hi

 

Out side the loop iam getting either the final value  or as an array. I want each iteration outside the loop.

counter.jpg

thanks,


This code will execute in about a few nanosecond so, as others have said already, we need to know what other code segment consumes these iteration values that seem so important to you. It is crucial to catch all of them or is it sufficient to occasionally (e.g. every 20ms) monitor the progress of this loop?

 

You really need to provide more detail. Thanks!

0 Kudos
Message 6 of 10
(3,115 Views)

Please answer the questions. Simply saying you intend to read the all of the data is essentially meaningless. Why do you not read the data inside the loop? You need to provide details on what is going on in the rest of your code and why you think it's necessary to pass data from inside a for loop.

0 Kudos
Message 7 of 10
(3,114 Views)

I know we can read values inside the loop. I just wanna know is there any way to read array elements outside the loop.

0 Kudos
Message 8 of 10
(3,104 Views)
Solution
Accepted by topic author athiras

You've already been told yes and you've already been told some of the different ways (notifiers, locals, reference, queue, etc.). Since the information has been provided to your simple request, can the thread be considered closed? If you want details on how to implement something, you need to provide the details on what you are doing.

Message 9 of 10
(3,099 Views)

Four people told you yes.

 

Suggestions were offered...

 

I would recommed that you experiment with one of the suggestions so that you can observe what is going on..

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

0 Kudos
Message 10 of 10
(3,084 Views)