NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine TestStand array maximum minimum

Solved!
Go to solution

Is there a function to return a maximum and minimum array value for a TestStand array?

 

I could create a LV code module and pass the array in, evaluate using a LV function and return the results, but I'm looking for a TestStand native or possibly an ActiveX function...


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 1 of 5
(6,658 Views)

Hi Phillip,

 

In my opinion there no build in function providing this.

But you can do this by using two build in steps.

Iterate through the Array with the ForEach Step Type and then determine in a simple Statment step the MIN and MAX Value of your array

 

 

Hope this helps

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 5
(6,639 Views)
Solution
Accepted by topic author PhillipBrooks

Hi Phillip,

 

Try this example

 

Juergen

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

This works fine. I didn't mention in my original post that I was looking to do this in TestStand 3.0.

 

I've just started looking at all the new features in 4.1 as part of the upgrade that I am responsible for. I might even try to create a template for this so that it can be easily dropped where need.

 

Thanks for the help!


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 4 of 5
(6,623 Views)

You can also use an expression-step with following content:

 

Sort(Locals.MyArray,True),
Locals.MyMin=Locals.MyArray[0],
Locals.MyMax=Locals.MyArray[GetNumElements(Locals.MyArray)-1]

 

 

Please be aware, that the second parameter in Sort-function reorders the origin array. If you don't want this behaviour, you will need a temporary array like this:

Locals.MyArrayTemp=Sort(Locals.MyArray,True),
Locals.MyMin=Locals.MyArrayTemp[0],
Locals.MyMax=Locals.MyArrayTemp[GetNumElements(Locals.MyArrayTemp)-1]

 

Message 5 of 5
(2,650 Views)