TGraph from .txt file with HH:MM:SS time format

I have a .txt file of below format, i want to plot time in x axis and any one current value (A) column in y axis. pls help

-3999.691162 V  -0.000620 A    -3999.670898 V  -0.000622 A    -3999.666016 V  -0.000620 A    -3999.643311 V  -0.000620 A  2020-04-03_16:39:00
    2 -3999.690674 V  -0.000620 A    -3999.671387 V  -0.000622 A    -3999.662598 V  -0.000620 A    -3999.641602 V  -0.000620 A  2020-04-03_16:39:01

Your file seems to have lost its formatting when you posted it on the forum. Its structure is not very clear. Can you re-structure it ?

I guess the easiest would be to use the the fscanf function to read the file and store data in some variables (which you can then easily use to create any plots).

Sorry the format was distorted. Below is the correct one.

2020-04-28_08:59:37 -99.983131 V -0.000015 A

First Column: date and time
2nd col: voltage
3rd col: Current

There are hundred thousands of such entry.
i want to plot time(in secs) in x axis and current value (A) in y axis.

As suggested fscanf is probably the way to go. Then you will have to make a plot with time axis. See the timeonaxis*.C examples.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.