problem with cell array e unique
조회 수: 5 (최근 30일)
이전 댓글 표시
>> 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
채택된 답변
Star Strider
2023년 8월 30일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!