Skip to main content
Best answer by Werner_E

Here is a utility function. The input is a vector of scalar values of any length. The return value is that vector element which occurs least often. If there are several, the first one to appear is chosen.

Werner_E_0-1665573446917.png

And here is a function working just for your special case of a three element vector with one single value

Werner_E_0-1665574320539.png

 

2 replies

ttokoro
21-Topaz I
21-Topaz I
October 12, 2022

image.pngimage.pngimage.png

t.t.
18-Opal
October 13, 2022

Hi

 

Can this be done within a tolerance band?

 

If I had 

ppal_0-1665627898742.png

 

I'd like to select 15 000

 

25-Diamond I
October 13, 2022

I guess your approach is not what ppal is looking for. Maybe you misunderstood the intention.

If no two values are equal, not the largest value should be returned but the value which is farthest apart from the other two.

So with input 9, 14, 15 your function would return 15 while it should return 9.

Werner_E25-Diamond IAnswer
25-Diamond I
October 12, 2022

Here is a utility function. The input is a vector of scalar values of any length. The return value is that vector element which occurs least often. If there are several, the first one to appear is chosen.

Werner_E_0-1665573446917.png

And here is a function working just for your special case of a three element vector with one single value

Werner_E_0-1665574320539.png