フィルターのクリア

Value associate to a parameter in a text

1 回表示 (過去 30 日間)
Jack
Jack 2018 年 7 月 9 日
コメント済み: Jack 2018 年 7 月 9 日
So I have a text file similar to the following:
DELZZ 3301.23
KUTY 4.32 SERI -0.023
I want Matlab to read the file and return values associate to each parameter (DELZZ, KUTY,SERI,...) Any suggestion?

採用された回答

Paolo
Paolo 2018 年 7 月 9 日
編集済み: Paolo 2018 年 7 月 9 日
data = fileread('mytextfile.txt');
val = regexp(data,'(?<=\s)(-?\d*\.?\d*)(?=\s|$)','match');
  7 件のコメント
Paolo
Paolo 2018 年 7 月 9 日
That's right, you will need to use the greedy * quantifier rather than the + quantifier. Since you need to match those values too, use:
(?<=KUTY01\s)-?\d*\.?\d*
I'll update my answer.
Jack
Jack 2018 年 7 月 9 日
Thank u so much

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

その他の回答 (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