NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Teststand Array Average

Solved!
Go to solution

Hello Community,

 

Using Teststand 2014 32bit

 

I have an array that is one-dimensional with a size of ten (Array[10]). I want to be able to take an average of this array in Teststand. Using a statement expression I am able to do Numeric = ((Array[0] + Array[1] + ... Array [10]) /10), but that is tedious. Especially, if I have an array of more than ten.

 

In Teststand is there a math operation or another way to get the array average?

0 Kudos
Message 1 of 6
(6,654 Views)
Solution
Accepted by topic author MechUnit

I don't think it's possible in a single expression.  Consider the attached example that does it in a single step.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 6
(6,634 Views)

Hi MechUnit,

 

looping a step as Jigg suggested is the best solution because it is a real KISS solution.

But additionally I would like to share a single expression example, by using the powerful

Evaluate() function.

 

Regards

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Download All
Message 3 of 6
(6,619 Views)

Hope it will be good if we have an option like Add Array function is TestStans Expression.

As others suggested use For Loop with Array size as your N for Loop.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 6
(6,614 Views)

Hi MechUnit,

 

I'd definately use a looping statement step;  I wrote an example last night but didn't have time to post it.

 

It looks like Jigg and Juergen have pipped me to the post Smiley Happy

 

See my attached example.

 

Regards,

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 5 of 6
(6,613 Views)

At the "Average Example.seq". I had to remove the Pre-Expression (Locals.DataAverage = 0)

 

Now it is working. Thank you

0 Kudos
Message 6 of 6
(3,797 Views)