findUniqueCounts

版本 1.0.0 (1.5 KB) 作者: Number seven
Find unique cells in a cell array and where they occur.
6.0 次下载
更新时间 2021/8/13

查看许可证

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]}

引用格式

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

MATLAB 版本兼容性
创建方式 R2021a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0