1

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.

Example:

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.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Raphael
  • 13
  • 2

2 Answers2

2

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

fdate[r_] := 
    DateList[ 
       Join[
           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"}}]
george2079
  • 38,913
  • 1
  • 43
  • 110
1

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.

Brett Champion
  • 20,779
  • 2
  • 64
  • 121
SAAN
  • 617
  • 6
  • 15