05-09-2012 10:16 AM
Hi,
I have a 1D array of values (about 1000 elements) which I need to remove some elements from. I need to calculate the mean and standard deviation of the array and if any of the array values are outside some multiple of the standard deviation away from the mean, I need to delete those elements and then relalculate the new mean. I'm not entirely sure how to go about doing this.
Thanks for any advice.
Solved! Go to Solution.
05-09-2012 10:27 AM
For Loop, or while loop.
Shift register to maintain array between iterations.
Comparison and case structure.
Delete from Array in case when you need to delete. Wire the array through in the case where you don't need to delete.
05-09-2012 10:48 AM
I'm not entirely sure how to do the comparison. If I wire the array into the loop, then my comparison gives me an array of booleans which I can't connect to the case structure. If I index my array into the loop, then I can't use the delete from array function.
Thanks for the help
05-09-2012 11:20 AM
You need to keep an index value in a shift register. If you deleted an element, pass the index straight through. If you did not delete an element, then you need to increment the index.
05-09-2012 11:43 AM
Its simple to have a condition and remove the elements that doesn't meet the condition. Check the attached vi for an example.
Good Luck