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

1 visualización (últimos 30 días)
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.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by