Counting the spesific word in text file
Afficher commentaires plus anciens
Hello, I have a text file and I want to see how much 'Hi there!' word inside of it. How can I do it? Thank you.
2 commentaires
Walter Roberson
le 3 Juin 2022
What do you want to have happen if one of the occurrences is "PHi there!"? or "hi there!"?
tinkyminky93
le 3 Juin 2022
Réponse acceptée
Plus de réponses (2)
VINAYAK LUHA
le 3 Juin 2022
Modifié(e) : VINAYAK LUHA
le 3 Juin 2022
data = fileread("content.txt")
pattern="hi there!"
substr_freq =count(data,pattern)
%substr_freq has your answer
1 commentaire
tinkyminky93
le 3 Juin 2022
Modifié(e) : tinkyminky93
le 3 Juin 2022
tinkyminky93
le 3 Juin 2022
Modifié(e) : tinkyminky93
le 3 Juin 2022
0 votes
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!