finding most common letter in a string
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Azzi Abdelmalek
il 12 Nov 2015
Modificato: Azzi Abdelmalek
il 12 Nov 2015
y='asdqwdqwdasasdasdaasasdwdqwd'
[ii,jj,kk]=unique(y)
a=accumarray(kk,1)
idx=a==max(a)
out=ii(idx)
0 Commenti
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!