problem with cell array e unique
6 views (last 30 days)
Show older comments
>> class(RankList)
ans =
'cell'
>> typeRank=unique(cell2table(RankList))
Error using tabular/unique
Unable to group rows using unique values of the table variable 'RankList'. UNIQUE returned an error.
Caused by:
Error using matlab.internal.math.uniqueCellstrHelper
Cell array input must be a cell array of character vectors.
0 Comments
Accepted Answer
Star Strider
on 30 Aug 2023
There are 9 empty cells in ‘RankList’ and they were causing the problem.
Try this —
LD = load('matlab_RankList.mat')
RankList = LD.RankList
idx = cellfun(@(x)~isempty(x), RankList); % Logical Vector
Empty_Cells = nnz(~idx)
RankListFull = RankList(idx) % Non-Empty Entries
RankListUnique = unique(RankListFull) % Unique Entries (Sorted)
RankListUnique = unique(RankListFull, 'stable') % Unique Entries (Un-sorted)
.
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!