I have a array X=[1 2 3 1.01 2.01 4 5 1.01 3.01] I want to all index of this array are similar and difference<=0.01 in matlab answer is
X=[1 2 3 1.01 2.01 4 5 1.01 3.01]
<=0.01
Y=cell(5,1) for idx=1:numel(Y) Y{idx}=find(abs(X-idx)<=.2); end