I have a cell array like this:
name = {'aa', 'bb', 'bb','cc','cc','ee','ff','ff','ff'};
I would like to get the indices which are duplicated. Idx = 2,4,7.
I use strcmp and it didn't work.

 채택된 답변

madhan ravi
madhan ravi 2023년 12월 2일
편집: madhan ravi 2023년 12월 2일

0 개 추천

[~, b, c] = unique(name);
idx = b(sum(b(c) == unique(b(c)).') > 1)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

질문:

2023년 12월 2일

댓글:

2023년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by