Use ismembertol to locate the data points in x that are within tolerance of the grid
points in gridPoints. Use these options with ismembertol:
- Specify ByRows as true, since the point coordinates are in the rows of x.
- Specify OutputAllIndices as true to return all of the indices for rows in x that are
within tolerance of the corresponding row in gridPoints.
[LIA,LocB] = ismembertol(gridPoints, x, 0.05, ...
'ByRows', true, 'OutputAllIndices', true);
For each grid point, plot the points in x that are within tolerance of that grid point.
figure
hold on
Group Scattered Data Using a Tolerance