Plotting data on time (date) axis

Rook picture Rook · Jan 10, 2010 · Viewed 62.6k times · Source

I have data like this:

22.10.1980. 100  
25.10.1980. 120  
26.10.1980.  12

(only much more of it, and for each date, several independent measurements on the right).

Now, this is probably trivial, but I've never done anything like it in MATLAB, and am having problems finding similar examples online. I need to plot the data on a time/showing dates axis (x axis), with all dates inside (so, 23. and 24. as well ... for which I don't have measurements).

How can I get dates to show up on a plot axis?

Answer

monksy picture monksy · Jan 10, 2010

It seems like it might be the best to use datetick.

Usage: datetick('x') or datetick('x', dateformat) with the available formats as explained in the documentation.