Search an entire text file for a word
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lauren Harkness
am 12 Okt. 2017
Beantwortet: Cedric
am 12 Okt. 2017
If i have a text file and am looking for the number of times a specific word appears in it, how would I go about doing that? I tried using the "contains" and "strfind" but they aren't working because its a text file not a string.
0 Kommentare
Akzeptierte Antwort
Cedric
am 12 Okt. 2017
content = fileread( 'MyTextFile.txt' ) ;
and then you can STRFIND or REGEXP or anything else on content, which is a char array.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!