フィルターのクリア

Read specific string in a large text lines

3 ビュー (過去 30 日間)
Praveen Choudhury
Praveen Choudhury 2017 年 8 月 10 日
コメント済み: Brian Hannan 2017 年 8 月 10 日
I have lines in a text file like this
</TypeInfo><TypeMaxValue>65535</TypeMaxValue> <TypeMinValue>0</TypeMinValue><Name>Rick</Name>
How can I textscan and bring just
<Name>Rick</Name>
into my cell array?

採用された回答

Brian Hannan
Brian Hannan 2017 年 8 月 10 日
Check out regexp. Something like
regexp(myString, 'Name>\w*</Name')
will do the trick.
  5 件のコメント
Praveen Choudhury
Praveen Choudhury 2017 年 8 月 10 日
How can I extract a word where the word contains symbols, brackets as well as numbers?
See the attached of what I am talking. I am unable to extract the words in variable B.
Brian Hannan
Brian Hannan 2017 年 8 月 10 日
Take a look at the regexp documentation for some ideas. There's an example over there that solves this problem. It's titled "Capture Substrings of Matches Using Ordinal Tokens".

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by