finding most common letter in a string
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
say I have a string y='asdqwdqwdasasdasdaasasdwdqwd' How do I find the letter that occurs the most in y which is clearly 'a' so have something like mostcommonletter='a'
0 comentarios
Respuestas (1)
Azzi Abdelmalek
el 12 de Nov. de 2015
Editada: Azzi Abdelmalek
el 12 de Nov. de 2015
y='asdqwdqwdasasdasdaasasdwdqwd'
[ii,jj,kk]=unique(y)
a=accumarray(kk,1)
idx=a==max(a)
out=ii(idx)
0 comentarios
Ver también
Categorías
Más información sobre Characters and Strings 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!