LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract N maximum values from a table

Hello,

 

I would like to extract from a table that contain random values  6 maximum values, also the difference between those values should be 20
if this condition is not verified  we check on the table for the next max values on the table and so on. Till we construct a table that contain 6 max values and the difference betweend them it is big than 20

 

Thank you for your help. Regards

0 Kudos
Message 1 of 5
(2,037 Views)

Bonjour,

 

Je voudrais réaliser un petit programme qui va me servir à extraire les 6 valeurs max d'un tableau qui contient des valeurs aléatoire sachant que la différence entre ces valeurs doit etre  20 si ce n'est pas le cas donc   on affichera la valeur ensuite .... etc  jusqu'a ou on rempli un tableau de 6 valeurs.

 

Merci de votre aide

0 Kudos
Message 2 of 5
(2,036 Views)

Hi virtman,

 

what have you tried so far? Where are you stuck?

 

Take the values from your table and sort them: now it's much easier to find the biggest values…

 

(No need to start two threads on the very same topic!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(2,017 Views)

place your random values into a 1D array, sort the array, use array subset to get your 6 values.  

 

use array max/min on this subset and determine the range (your condition of range => 20).  if not satisfied, get the next value from your source array and repeat.

 

The LabVIEW CORE fundamentals course work will give you everything you need to accomplish this task given the advice above.

0 Kudos
Message 4 of 5
(2,013 Views)

Seems like poorly define homework.

 

  • Are these integers or floating point values?
  • How big is the table? can it contain duplicate values? 
  • If you specify the maximum, you also need to specify the minimum.
  • How do you define the difference between 6 values? It is not obvious how to calculate that. Do you mean the sum instead? The difference between largest and smallest of the six?
  • In one place you say that the difference needs to be 20 and elsewhere you say that the difference needs to be big (bigger?) than 20. What is it?
  • What should happen if no solution is possible?
0 Kudos
Message 5 of 5
(2,011 Views)