MATLAB: When using scatter, how can I delete all the repeated values except the minimum for each x value

MATLABplotscatter

I am plotting data that has more than one y value for every x value. I'm using scatter(x,y) to plot this, but I want to only show the minimum of each x value. Both x and y are 14641 x 1 vectors. Any suggestions?

Best Answer

[ux, iax, icx] = unique(x);
min_at_x = accumarray(icx, y, [], @min);
scatter(ux, min_at_x);