필터 지우기
필터 지우기

I want to read a formatted text file with number and strings and I want to separate data

조회 수: 2 (최근 30일)
Dear all,
I want to cut each id of data into a different variable.
=======================I want to the output like =================================
data 1 =
ID 2010
2010 12 29 17 35 13
1 123.456 0.456 2 2 0 0 0
1 123.456 0.456 3 1 0 0 111
1 120.456 1.456 2 2 0 0 0
1 120.456 1.456 3 1 0 0 111
1 122.456 2.456 2 2 0 0 0
1 122.456 2.456 3 1 0 0 111
data 2 =
ID 2013
2013 12 29 10 25 15
1 103.456 4.456 2 2 0 0 0
1 113.456 3.456 3 1 0 0 111
1 183.456 6.456 2 2 0 0 0
1 173.456 3.456 3 1 0 0 111
1 193.456 6.456 2 2 0 0 0
1 173.456 9.456 3 1 0 0 111
:
:
:
:
etc
============== below are the few lines of the text =======================
Note:The sentence after % is for guidance (Not in the data)
====================================================================
a1 ID 2010 % id of data 1
a2 2010 12 29 17 35 13 % (Starting Year Month Day and Starting Hour Minute Second ) of data 1
0 123.456 123.456 270.00 92.0 0
1 123.456 0.456 AB 2 2 0 0 0
1 123.456 0.456 AB 3 1 0 0 111
:
:
--- line with No. 1 will repeat until line with No. 0 appears
0 123.456 123.456 270.00 92.0 0
1 120.456 1.456 AB 2 2 0 0 0
1 120.456 1.456 AB 3 1 0 0 111
:
:
--- line with No. 1 will repeat until line with No. 0 appears
0 123.456 123.456 270.00 92.0 0
1 122.456 2.456 AB 2 2 0 0 0
1 122.456 2.456 AB 3 1 0 0 111
a3 % end of data 1 (a3 : Always used in end of data )
a1 ID 2013 % id of data 2
a2 2013 12 29 10 25 15 % (Starting Year Month Day and Starting Hour Minute Second ) of data 2
0 123.456 123.456 270.00 92.0 0
1 103.456 4.456 CD 2 2 0 0 0
1 113.456 3.456 CD 3 1 0 0 111
:
:
--- line with No. 1 will repeat until line with No. 0 appears
0 123.456 123.456 270.00 92.0 0
1 183.456 6.456 CD 2 2 0 0 0
1 173.456 3.456 CD 3 1 0 0 111
:
:
--- line with No. 1 will repeat until line with No. 0 appears
0 123.456 123.456 270.00 92.0 0
1 193.456 6.456 CD 2 2 0 0 0
1 173.456 9.456 CD 3 1 0 0 111
a3 % end of data 2 (a3 : Always used in end of data )
:
:
:
etc
I will be thankful if anyone can help.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by