From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing an Array and keeping past values

Solved!
Go to solution

I am fairly new to LabVIEW and have never used a language like this. I am very experience in MATLAB and C programming, but need some assistance on this type of programming.

 

My issue is I need to capture the average of an array (mean) and place that constant into another array (see excel example). Once this is done, it will push the latest value down one index, and place the newest value in the index 0 position. I have tried many different methods and cannot seem to get any of them to work, or I may be using them all incorrectly.

 

Methods Used:

Decrementing

Auto-Indexing

Shift Registers

 

Any assistance will be of great help and if I need to clarify more, please feel free to ask. My looping structure may also be causing the problem, but I am not sure how that entirely works as well in LabVIEW. 


Thanks in Advance

Download All
0 Kudos
Message 1 of 4
(2,326 Views)

Your code is basically dead and just rattled down the wire in one shot. Where does the new data come from? Should the average be done over the last N points or over all points? (Sorry, I don't understand your excel file).

 

The FOR loop does not do anything. The sequence structure does not do anything useful, if you want to dealy the FOR loop, all you need is wire the output of the wait to the loop boundary.

 

The average of an array is hopefully not a "constant", but depends on the array.

 

Basically, all your data sources belong inside a loop if they should get re-read and you need to keep your new array in a shift register. Maybe ""mean ptbypt" would do what you want directly.

 

Message 2 of 4
(2,315 Views)
Solution
Accepted by topic author Brschnei

Here is a quick example that could give you some ideas (maybe I misunderstood some specifications)

 

It will read the array of controls every 5 seconds and append the average to a new array.

 

 

Message 3 of 4
(2,309 Views)

That helped Immensely. I appreciate it. That was mainly my problem was keeping the old data, without having the new array rewrite it. 

 

Thank you for the help.

0 Kudos
Message 4 of 4
(2,284 Views)