I have a sorted array of points like
x=[1 1 1 2 2 4 4 5 6 ......7 8 8 9 9]
I want to have an array containing 3 elements with minimum elements and 3 with maximum elements of this array (ignoring the same elements)
The desired results for the above would be
ans=[1 2 4 7 8 9]
You can do this using the function UNIQUE: