LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find lowest 5% value from 1D array?

Hi Guys,

 

I have a set 1D of array with array size of 60. 

I sorted them and now need to know the top and bottom 5% value.

 

Suppose, the 1D array:

0.0006

0.0056

0.5

0.57

0.73

1.67

3.56

10.45

11.32

13.45

 

I need to divide this array into 3 sections: mean value, top 5% and bottom 5% value. 

 

Can anyone gude me to do it? 

0 Kudos
Message 1 of 9
(397 Views)

You posted a simple mathematical questions in a LabVIEW forum. Do you know the math and have trouble implementing it in LabVIEW? Do you have problem with the math itself?

 


@Hk637 wrote:

I need to divide this array into 3 sections: mean value, top 5% and bottom 5% value. 


If you have 60 points, each point is ~1.67% of all points.  So how many points would be 5%?

 

The mean value is a scalar, not a "section". Can you explain the terminology and what you mean by "divide the array"? Obviously this is not a mathematical division, but a splitting.

0 Kudos
Message 2 of 9
(356 Views)

Hi, as altenbach mentioned, it is just a mathematical problem, but here is an example of how it could be done in case you still have doubts.

I would like to comment that depending on whether you are looking for exactly 5% or rounding, you should use an "absolute value" or not.

 

jcosta1_2-1712646546197.png

 

 

 

Best regards, a beginner in LabVIEW (2018, 2020, 2021)

Best regards,
jcosta

A beginner in LabVIEW using LV2018/2020/2021
0 Kudos
Message 3 of 9
(291 Views)

Hi jcosta,

 


@jcosta1 wrote:

here is an example of how it could be done in case you still have doubts.


You know your two FOR loops do just the same as an ordinary ArraySubset function?

And you could also replace the whole ReverseArray+FOR+ReverseArray by a simple DeleteFromArray function?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(288 Views)

Hi, that was my mistake, it really is much simpler and more efficient that way. Thank you very much for the correction and teaching.

jcosta1_0-1712647462776.png

 

Best regards.

A beginner in LabVIEW using LV2018/2020/2021

Best regards,
jcosta

A beginner in LabVIEW using LV2018/2020/2021
Message 5 of 9
(280 Views)

The compiler probably is smart enough to do this optimization for you, but instead of multiplying with 5 and dividing with 100 you can just multiply with 0.05.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 9
(265 Views)

Again, the title and initial information does not give a clear enough message as to what the OP is actually requesting.  I looked at the data as all values that are within 5% of the Min-Max values.

Minions_0-1712665195663.png       

Minions_1-1712665213683.png

 

 

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 7 of 9
(229 Views)

I would use the built in percentile .vi

you can even look at the .vis blockdiagram and it is completly written in G...

 

percentiles.png

 

Message 8 of 9
(218 Views)

20 to 80 5 to 95
alexderjuengere_0-1712751822494.png alexderjuengere_0-1712751554323.png

 

 

attached as labview 2020

 

 

0 Kudos
Message 9 of 9
(161 Views)