How can I find the subset of a table that corresponds to a set of conditions/conditions?

I have often encountered this problem in LabVIEW, probably the result of my Matlab based thinking on the tables. Suppose I have a 1 d array that consists of a real number between 0 and 2 (for example):

1.3 0.1 1.9 0.7 1.4 1.5 1.5 0.8 1.3 0.3 1.4 1.4 0.1 0.6 0.1 0.2 1.6 1.6 1.4 0.6 0.1 1.9

and I want to know the average of the subset of values greater than 0.5 and less than 1.2:

average ([0.8 0.7 0.6 0.6]) = 0.6750.

How can I find the subset of the array that satisfies the condition > 0.5 &<1.2>

For your example (values between 0.5 and 2) If you wish:

I would do something like this:

I have generated just a table of 10 random numbers between 0.0 and 2.0

The following loop sorts the data, using "range and force."
It then displays the data in the selected range.

The last step is to take the average

I have attached the VI if you do not want to use the code.

Tags: NI Software

Similar Questions

Maybe you are looking for