Plotting a graph of a date !!
이전 댓글 표시
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')
채택된 답변
추가 답변 (1개)
Peter Perkins
2017년 1월 12일
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)
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!