Plotting a graph of a date !!
Mostrar comentarios más antiguos
I am trying to plot a graph of the amount of rain over one year ( 12 months) using the code below, but the problem is that only 3 months appear on the graph ( Jan, Feb and March) and I have no I idea where I went wrong !!
startDate = datenum('Oct 1991');
endDate = datenum('Sep 1992');
xData = linspace(startDate,endDate,12);
plot(xData,Max_rain)
datetick('x','mmm')
Respuesta aceptada
Más respuestas (1)
Peter Perkins
el 12 de En. de 2017
In recent versions of MATLAB (since R2014b), do this:
>> t = datetime(1991,10,1) + calmonths(0:11)
t =
1×12 datetime array
Columns 1 through 9
01-Oct-1991 01-Nov-1991 01-Dec-1991 01-Jan-1992 01-Feb-1992 01-Mar-1992 01-Apr-1992 01-May-1992 01-Jun-1992
Columns 10 through 12
01-Jul-1992 01-Aug-1992 01-Sep-1992
>> x = 1:12;
>> plot(t,x)
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!