Reputation: 3405
I have the matrix
mat_=[1 1.25;
2 1.75;
3 1.49; % Should be deleted as (abs(1.25-1.49)<.25)
4 1;
5 0.9; %(abs(1-.9)<.25)
6 2.05];
I want to get a matrix with unique value and tolerance (e.g., tolerance=0.25
). I made this matrix mat_unique
manually just to explain my point
mat_unique=[1 1.25; 2 1.75; 4 1 ;6 2.05];
Any idea??
Upvotes: 1
Views: 373
Reputation: 221774
One approach -
tol=0.25 %// tolerance
mat_unique = mat_(~any(triu(abs(bsxfun(@minus,mat_(:,2),mat_(:,2).'))<tol,1)),:)
Upvotes: 4