Code covered by the BSD License  

Highlights from
unique with tolerance

5.0

5.0 | 1 rating Rate this file 16 Downloads (last 30 days) File Size: 1.54 KB File ID: #27498

unique with tolerance

by Siyi Deng

 

06 May 2010 (Updated 29 Oct 2010)

Similar to Unique, gives unique element within a tolerance.

| Watch this File

File Information
Description

UNIQUETOL Unique element within a tolerance.

[Y,I,J] = UNIQUETOL(X,TOL) is very similar to UNIQUE, but allows an additional tolerance input, TOL. TOL can be taken as the total absolute difference between similar elements. TOL must be a none negative scalar. If not provided, TOL is assumed to be 0, which makes UNIQUETOL identical to UNIQUE.
 
    UNIQUETOL(...,'ROWS')
    UNIQUETOL(...,'FIRST')
    UNIQUETOL(...,'LAST')
    These expressions are identical to the UNIQUE counterparts.

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
17 May 2010 Siyi Deng

Here's an example:

x = [1 2 3;
       1+eps 2 3;
       2 3 4];

[y1,i1,j1] = unique(x,'rows')

y =

    1.0000 2.0000 3.0000
    1.0000 2.0000 3.0000
    2.0000 3.0000 4.0000

i1 =

     1
     2
     3

j1 =

     1
     2
     3

[y2,i2,j2] = uniquetol(x,10*eps,'rows')

y2 =

     1 2 3
     2 3 4

i2 =

     1
     3

j2 =

     1
     1
     2

19 May 2011 Richard Crozier  
Please login to add a comment or rating.
Updates
29 Oct 2010

improved "rows" capacity.

Tag Activity for this File
Tag Applied By Date/Time
unique Siyi Deng 06 May 2010 10:28:14
tolerance Siyi Deng 06 May 2010 10:28:14
array Siyi Deng 06 May 2010 10:28:14

Contact us at files@mathworks.com