problem with cell array e unique
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Luca Re
el 30 de Ag. de 2023
Respondida: Star Strider
el 30 de Ag. de 2023
>> 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 comentarios
Respuesta aceptada
Star Strider
el 30 de Ag. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!