LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

linked loops

Solved!
Go to solution

Hi!

In the attacched file I write an array using loop1. In the loop2 2 I build an array of arrays, but im not able to link the two loops in order to add a new array in loop 2 everytime array in loop 1 change.

Any suggestion?

Thank You

Antonio

0 Kudos
Message 1 of 6
(2,710 Views)
0 Kudos
Message 2 of 6
(2,708 Views)

Thank You, Pnt.

But I think my request was not cleat at all.

Using the vi You sent me i can write an array of arrays done by N arrays all the same

What i need is something different

1) write the 1st array

2)put it in 2nd 2D array

3) write the 2nd array

4)put it in the 2nd array

.

.

.By this way in the 2D array every element will be different from the other

In order to explain im collecting plant data usind DDE. I write those data in the first array, every time i make a request to DDE server.

 I would like to write an array done by N of previous column values in order to average those. During and after my average process the first loop (DDE request must run and it must not stop when average has been performed). For that reason I would like to separato two loops: one only for DDE request, the other, when i like, can perform average on N samples.

 

Thank you

 

 

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

"DDE request must run and it must not stop when average has been performed"

 

I don't think that you will have any problems, as it cost too little performance but here is an alternative.

 

0 Kudos
Message 4 of 6
(2,672 Views)
Solution
Accepted by topic author Yixiao-uncle

antonio ferrante wrote:

In the attacched file I write an array using loop1. In the loop2 2 I build an array of arrays, but im not able to link the two loops in order to add a new array in loop 2 everytime array in loop 1 change.


Right now, but loops are running independently, and there is no guarantee that loop 2 will wait until new data has been produced in loop 1. Your second loop makes no sense. It simpliy duplicates the current data 100 times.

 

The correct way to do this is by using a queue. Here's is a very quick draft on how to process the 1D array in the second loop whenever new data has been generated.

 

 

 

You still need to add error handling and the averaging code. Most likely you want to initialize the shift register with a fixed size 2D array according to the desired number of averages and then replace the oldest row with each call before averaging. See how far you get and ask again if you get stuck. 🙂

 

 

Message Edited by altenbach on 11-30-2008 11:07 AM
Download All
Message 5 of 6
(2,648 Views)

antonio ferrante wrote:

I would like to write an array done by N of previous column values in order to average those.


Here is a quick example how you would average the last 10 values for each column using a fixed size buffer. Modify as needed.

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