フィルターのクリア

Search an entire text file for a word

2 ビュー (過去 30 日間)
Lauren Harkness
Lauren Harkness 2017 年 10 月 12 日
回答済み: Cedric 2017 年 10 月 12 日
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.

採用された回答

Cedric
Cedric 2017 年 10 月 12 日
content = fileread( 'MyTextFile.txt' ) ;
and then you can STRFIND or REGEXP or anything else on content, which is a char array.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by