UNIQUEWITHEQUALNANS

Set unique, treating NaNs as equal (v2.0, mar 2009)
2,2K Downloads
Aktualisiert 6. Apr 2009

Lizenz anzeigen

UNIQUEWITHEQUALNANS - Set unique, treating NaNs as equal
B = UNIQUEWITHEQUALNANS(A) for the array A returns the same values as in A
but with no repetitions. B will also be sorted (NaNs as last).

UNIQUEWITHEQUALNANS(A,'rows') for the matrix A returns the unique rows
of A, treating NaNs as equal.

[B,I,J] = UNIQUEWITHEQUALNANS(...) also returns index vectors I and J such
that B = A(I) and A = B(J) (or B = A(I,:) and A = B(J,:)).

[B,I,J] = UNIQUEWITHEQUALNANS(...,'first') returns the vector I to
index the first occurrence of each unique value in A.
UNIQUEWITHEQUALNANS(...,'last'), the default, returns the vector I to
index the last occurrence.

Example:
A = [1 2 NaN ; 1 2 NaN ; 1 2 NaN] ;
unique(A,'rows')
% -> [1 2 NaN ; 1 2 NaN ; 1 2 NaN] ;
uniquewithequalnans(A,'rows')
%-> [1 2 NaN]

For a cell array of strings, this function behaves exactly like UNIQUE.

See also unique, ISEQUALWITHNANS.

v2.0, mar 2009 - update to deal with recent versions of UNIQUE

Zitieren als

Jos (10584) (2024). UNIQUEWITHEQUALNANS (https://www.mathworks.com/matlabcentral/fileexchange/12292-uniquewithequalnans), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R13
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.1.0.0

update to deal with recent versions of UNIQUE

1.0.0.0