File Exchange

image thumbnail

uniqueCells

version 1.2.1 (2 KB) by Konrad
Implementation of unique for ND cell arrays of mixed type. Avoids num2str and provides switches for unique rows and to treat NaNs as equal.

5 Downloads

Updated 13 Aug 2018

View License

[ outcell, iIn, iOut ] = uniqueCells( incell [, 'rows', 'equalnan'] )

Usage is similar to unique().
The 'rows' switch returns unique rows in a matrix of cells. Otherwise, ND cell arrays are supported.
The 'equalnan' switch treats NaNs as equal.

As sorting is not possible for mixed-type cells the output corresponds to
the 'stable' switch in unique(). The occurrence-switch of unique() is NOT
implemented.

The following is true (w/o the 'rows' switch'):
isequal(incell(iIn), outcell)
isequal(outcell(iOut), incell)

Using the 'rows' switch:
isequal(incell(iIn,:), outcell)
isequal(outcell(iOut,:), incell)

The algorithm performs exhaustive pairwise comparisons using isequal
making it exact and type-independent (in contrast to implementations
using num2str); however this may come at the expense of performance.

Comments and Ratings (0)

Updates

1.2.1

Fixed typo.

1.2.0

Input checking, error handling & compatibility improved.

MATLAB Release Compatibility
Created with R2017a
Compatible with R2007b to any release
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video