Help - read and plot several .txt files

1 view (last 30 days)
Vasco Bernardo
Vasco Bernardo on 21 Mar 2019
Commented: dpb on 21 Mar 2019
Dear all,
I would like to plot several output.txt files (2nd and 3rd column) on the same graph. The configuration of one .txt files are bellow. The number of lines can be diferent between the .txt files but both headerlines are equal. The 0 values on the firsts substeps can be ignored (they will always be present in all .txt files so can be assumed as part of headers)
I will have for example output1.txt, output2.txt, output3.txt.....
Thanks in advance.
Best,
OUTPUT -------------(line 1 - file starts here)------------------
substep displ_floor_5_X_[mm]
base_reaz_X_[kN]
1 0,00 0,00
2 0,00 0,00
3 0,00 0,00
4 0,00 0,00
5 0,00 0,00
6 0,00 0,00
7 0,00 0,00
8 0,00 0,00
9 0,00 0,00
10 0,00 0,00
1 0,50 28,41
2 1,01 56,79
3 1,52 85,38
4 2,02 113,62
5 2,53 141,67
6 3,04 169,41
7 3,54 196,73
8 4,05 222,40
9 4,55 247,06
10 5,06 270,62
11 5,56 292,96
12 6,07 314,24
13 6,57 334,03
14 7,07 352,56
15 7,58 370,01
16 8,08 386,85
17 8,58 402,61
18 9,09 417,53
19 9,59 431,72
20 10,10 445,59
21 10,60 458,67
22 11,10 471,18
23 11,61 483,20
24 12,11 494,81
25 12,61 505,55
26 13,11 515,58
27 13,62 525,32
28 14,12 535,02
29 14,62 544,34
30 15,12 553,39
31 15,63 562,21
32 16,13 571,02
33 16,63 579,52
34 17,13 587,80
35 17,64 595,90
36 18,14 603,62
37 18,64 611,03
38 19,14 618,26
39 19,64 624,73
40 20,14 631,24
41 20,58 546,72
42 21,08 555,42
43 21,59 563,33
44 22,09 570,11
45 22,59 576,46
46 23,08 581,55
47 23,58 585,95
48 24,11 460,56
49 24,61 465,35
50 25,11 469,85
51 25,61 473,85
52 26,11 477,58
53 26,62 481,13
54 27,12 484,59
55 27,62 487,99
56 28,12 491,34
57 28,47 302,85
  1 Comment
dpb
dpb on 21 Mar 2019
See FAQ https://matlab.fandom.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F; the DIR() solution is particularly easy to implement.
What have you tried and where did you get stuck???

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!