duplicating strings in a cell array

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.

 Réponse acceptée

madhan ravi
madhan ravi le 2 Déc 2023
Modifié(e) : madhan ravi le 2 Déc 2023
[~, b, c] = unique(name);
idx = b(sum(b(c) == unique(b(c)).') > 1)

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by