Search an entire text file for a word
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Cedric
il 12 Ott 2017
content = fileread( 'MyTextFile.txt' ) ;
and then you can STRFIND or REGEXP or anything else on content, which is a char array.
0 Commenti
Più risposte (0)
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!