My file. Txt has only two columns, where the 1st column is the time that the data was generated by the 2nd column has decimal values ​​1-100.


19/06/2013 at 14:31:43 ------ 75 .19
19/06/2013 at 14:31:54 ------ 62 .46
19/06/2013 at 14:32:04 ------ 55 .62
19/06/2013 at 14:32:14 ------ 48 .28
19/06/2013 at 14:32:24 ------ 33 .15

I would like to plot this data on a graph that represents the axis yo time on the x axis while the decimal values ​​... these graphics could be in columns in which the maximum value is 100.

  • $\begingroup$ is there really a space between the numbers (75SPACE.19) $\endgroup$ – george2079 Jun 25 '13 at 16:35

I assume you do not really have those spaces.. if you do its not much trouble to fix..

fdate[r_] := 
           Reverse@(Read[StringToStream[#], Number] & /@ 
                              StringSplit[ r[[1]] , "/"]), 
                   (Read[StringToStream[#], Number] & /@ 
                              StringSplit[ r[[3]], ":"])]];

 DateListPlot[{fdate[#] , #[[5]]} & /@ Import["C:....file.txt", "Table"]]

enter image description here

if you do have the stray spaces just add the two columns like this:

 DateListPlot[{fdate[#] , Plus@@#[[5;;6]]} & /@ Import["C:....file.txt", "Table"]]

Edit -- I understimated the power of datelist.. This does the same:

fdate[r_] :=  DateList[{r[[1]] <> " " <> r[[3]], 
       {"Day", "Month", "Year", "Hour",  "Minute", "Second"}}]

Use Import["file","Table"] to import data. In your case "file" should be "name.txt", You can use ListPlot[{{x1, y1}, {x2, y2}, ...}], where 'x' is the decimal value and 'y' is time.

But really I have no idea how to input date and time simultaneously in 'y'. You may use number as a symbol of time, because time is not repeated value, you identify them easily.


Not the answer you're looking for? Browse other questions tagged or ask your own question.