Code covered by the BSD License  

Highlights from
unique_no_sort_rows

3.0

3.0 | 1 rating Rate this file 3 Downloads (last 30 days) File Size: 1.32 KB File ID: #25187

unique_no_sort_rows

by Michael Petralia

 

31 Aug 2009 (Updated 31 Aug 2009)

find unique rows of a matrix without resorting the rows

| Watch this File

File Information
Description

Similar unique_no_sort in functionality, but adds the ability to find unique rows.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
cell array, matrices, matrix, rows, unique, unsorted, vector
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
02 Sep 2009 Johnson Wong

Must simpler would be:

[unique_sorted,i,j] = unique(A,'rows','first');
B = A(sort(i),:);

31 Aug 2009 Michael Petralia

fixed this. file should now work with M x N matrices, N>2

31 Aug 2009 us

does not work on matrices M x N with N > 2,
since your statement
B = unsorted(:,2:3);
should read
B = unsorted(:,2:end);

us

Updates
31 Aug 2009

modified the output of the code to not include a column of indices.

31 Aug 2009

made function extend to MxN matrices with N>2

31 Aug 2009

uploaded correct file

Contact us