Using textread and strfind to extract lines of data
2 ビュー (過去 30 日間)
古いコメントを表示
I have used textread to load a data file into memory. From here, I want to extract specific lines that contain a particular string. I imagine I can do this with strfind, but the documentation indicates it will only return the start index of the string. How can I extract the whole line of data?
1 件のコメント
Jonathan Epperl
2012 年 11 月 27 日
You probably used textread to load data into a variable, and if you didn't, then you should do so. Also you should give some more detail: What does your data look like, what do you mean by 'line', is your data separated by line breaks?
採用された回答
Paul Huter
2012 年 11 月 27 日
1 件のコメント
Jan
2012 年 11 月 27 日
There is no need to "clear s". "fprintf(fo, t{z})" will lead to errors, if the string contains a % character. Better:
fprintf(fo, '%s\n', t{z});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!