フィルターのクリア

Extracting data from an unformatted text file

3 ビュー (過去 30 日間)
Yro
Yro 2021 年 4 月 29 日
コメント済み: Rik 2021 年 4 月 30 日
Hi, I want to extract certain values from an unformatted text file, in the example I use the regexp function entering the format of the data I want to extract.
(file format)
...
<<<<< Function evaluation summary (I1): 582 total (581 new, 1 duplicate)
<<<<< Best parameters =
31 x1
7 x2
87 x3
83 x4
3 x5
63 x6
5 x7
72 x8
12 x9
51 x10
67 x11
82 x12
81 x13
35 x14
52 x15
13 x16
32 x17
19 x18
73 x19
24 x20
50 x21
71 x22
61 x23
22 x24
23 x25
27 x26
58 x27
77 x28
1 x29
<<<<< Best objective function =
1.0119441809e+00
...
The output does not work because it extracts undesired values.
str = fileread('OUTPUT.out');
expression = '\d*\s\w\w' ;
regexp = regexp(str,expression, 'match');
How can I extract the values with the presented format?
  2 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 4 月 30 日
hello
what do you want to extract and in which format ?
Rik
Rik 2021 年 4 月 30 日
You should rename your file to txt and attach it. That way, we can taylor our code to your exact file format.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by