How to find close values in matrix?

I want to find points which are close to each others, not alone.
for example, matrix = [ 1 1.1 7 17 0.99; 1 1.1 7 17 0.99;]
if I represent above matirx as *, (1,1) (1.1 , 1.1) (0.99,0.99) will be close to each others, like * in yellow circle.
Is there the way to find close values and erase others which are out of yellow circle ?

Answers (1)

michio
michio on 12 Sep 2016
Edited: michio on 12 Sep 2016
If you use R2015a or later, ismembertol function may help.
By default, ismembertol looks for elements that are within tolerance, but it also can find rows of a matrix that are within tolerance. Something like,
LIA = ismembertol(A,B,tol,'ByRows',true)
C = A(LIA,:);
is worth trying. C will be a set of rows from A which matches to any of rows of B within the tolerance specified by tol.
Please be noted that the exact syntax could differ depending on how you define your variables.

Asked:

on 12 Sep 2016

Edited:

on 12 Sep 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!