0

I am new to matlab. What I am trying to do is to plot the data I recorded from the phone on matlab. The data is looks like this {timestamp, value}.

The timestamp is recorded in millionseconds by calling the Java function System.currentTimeMillis(). Therefore I have two questions actually to plot it on matlab.

  1. How can I transform the timestamp from milliseconds to date format on matlab?

  2. How can I plot the data on matlab, where Y-axis is the value, and X-axis is the date? The graph should look like discrete dots.

Thanks a lot.

Foreverniu
  • 349
  • 1
  • 3
  • 18
  • 2
    1. Converting time stamps with 1.1.1970 offset to matlab datenum is discussed here: http://stackoverflow.com/questions/12211710/how-to-work-with-unix-timestamps-in-matlab – Daniel Jul 14 '14 at 23:02

1 Answers1

2

To create plots with dates / times on one axis, plot your data, then relabel the axis using datetick

plot(datenum('1-jan-2000'):datenum('10-jan-2000'),[1:10])
datetick('x','dd-mm')
Daniel
  • 36,610
  • 3
  • 36
  • 69