findUniqueCounts

Find unique cells in a cell array and where they occur.
6 Downloads
Updated 13 Aug 2021

View License

findUniqueCounts(inputCell) returns a cell array with the unique cells in inputCell and where they occur. The contents of each cell must be an array.
function uniqueCounts = findUniqueCounts(inputCell)
Inputs
inputCell - the cell array to work on
Outputs
uniqueCounts - a (N_unique,3) cell array where each row contains the unique cells, where N_unique is the number of unique entries. The columns of uniqueCounts are organised as follows:
- Column 1: cell contents
- Column 2: cell index in inputCell
- Column 3: array containing the indices in inputCell where repetitions occur. The first entry of this array is the same as the entry in Column 2
Example:
If inputCell = {[0];
[0;1;2;3];
[7;1];
[5;4;4];
[0];
[0;1;2;3]};
then uniqueCounts is:
uniqueCounts = {[0],[1],[1,5];
[0;1;2;3],[2],[2,6];
[7;1],[3],[3];
[5;4;4],[4],[4]}

Cite As

Number seven (2024). findUniqueCounts (https://www.mathworks.com/matlabcentral/fileexchange/97522-finduniquecounts), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0