08-07-2019 10:04 AM
I have a measurement I need to do 15 times, and then find the median of it. More of a beginner to TestStand so if you could explain in simple terms, that would be great.
Right now I only do it once and save the resulting measurement as a variable.
What would be the best way to loop it 15 times? I'm using LabVIEW so I'm thinking I could save all 15 results as variables and then use a LabVIEW VI to find the median, but not sure how to save 15 individual variables using a loop. That's just one idea, but let me know if you have any more efficient ones! Thanks in advance.
08-07-2019 10:34 AM
Hi mshask,
Welcome to TestStand! There are lots of different ways to do things in TestStand and I think you have a good idea so far.
What I would consider doing is using one Array Variable that holds 15 numbers instead of 15 variables, this will make organizing and passing your data much easier.
For looping your step you can either use a For loop from the flow control or set the Looping Properties of the Step you wish to loop. Then when your step executes you just have to write the resulting measurement to the Array at the same index as your loop index.
Then once your step is done you can call another LabVIEW step that takes the array as an input and in LabVIEW take the median of the array!
This is just one way to do this and like most thing's with TestStand there are lots of others.
Hope this helps!
08-07-2019 11:06 AM
So I put in a for loop and created an empty array variable-where do I put in this variable? My step within the for loop is expecting a Number (DBL) for the measurement. Do I go into LabVIEW and change this to an array or is there another step I have to create within the for loop to add it to the array variable in teststand?
08-07-2019 11:36 AM
If it were me I would have the VI take the measurements and find the median and return the value. Then in TestStand you can evaluate that against your limits.
Or in a two step process have a VI that gathers the measurements in an array and another step that takes in the array and finds the median and then returns the value. Then in TestStand evaluate against some limits. This option will give you more modularity in case you want to to other things to the array.
08-08-2019 03:47 PM
Here's a quick little example showing what I'm talking about, you shouldn't have to update your measurement VI, the only code changes would be modifying the Median vi to take in an array.