Mostrar comentarios más antiguos
hi!how can i find the most frequent word in string in matlab?
Respuesta aceptada
Más respuestas (1)
Sean de Wolski
el 29 de Mayo de 2012
Something like:
str = 'See Spot run, see Spot jump, see Spot eat';
C = regexp(lower(str),' ','split')';
[val,idxC, idxV] = unique(C);
n = accumarray(idxV,1);
[n idxC] %n occurences for word C(idxC)
obviously this needs to be augmented to take into account punctuation, whether you want to account for caps etc.
1 comentario
reyhane
el 29 de Mayo de 2012
Categorías
Más información sobre Language Support en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!