findUniqueCounts
Version 1.0.0 (1.55 KB) by
Number seven
Find unique cells in a cell array and where they occur.
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 LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |