Counting the spesific word in text file
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 3 Jun. 2022
What do you want to have happen if one of the occurrences is "PHi there!"? or "hi there!"?
tinkyminky93
am 3 Jun. 2022
Akzeptierte Antwort
Weitere Antworten (2)
VINAYAK LUHA
am 3 Jun. 2022
Bearbeitet: VINAYAK LUHA
am 3 Jun. 2022
data = fileread("content.txt")
pattern="hi there!"
substr_freq =count(data,pattern)
%substr_freq has your answer
1 Kommentar
tinkyminky93
am 3 Jun. 2022
Bearbeitet: tinkyminky93
am 3 Jun. 2022
tinkyminky93
am 3 Jun. 2022
Bearbeitet: tinkyminky93
am 3 Jun. 2022
0 Stimmen
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!