Match values to most similar from defined list

Hi all,

New to Dynamo.

I am trying to take a list of unique values that range from 0.2 to 0.8 but would like to simplify them to lets say 4 types. So instead of 100 unique values between 0.2 and 0.8, I’d like each value to be replaced with the closest value out of a list of four values (0.2, 0.4, 0.6, 0.8). Ideally the number of values that will be matched to can be only a slider to test 4, 5, 6 values between 0.2 and 0.8.


Any help? I was originally able to do this fairly easily in Grasshopper using the “Find Similar Member” component but haven’t been able to find a similar solution that doesn’t involve a huge array of > and < nodes.



Maybe this could work for you:


Other option can be to define a function that is finding the closest number
This is the test of the function
def GetSimilar(NumList:var,RefNum)



can you please re-post the image , cannot open it.