필터 지우기
필터 지우기

Setting the xlim for datetime data

조회 수: 235 (최근 30일)
Sophia
Sophia 2022년 1월 3일
댓글: Star Strider 2022년 1월 4일
I would like to set the xlim of this graph from Nov 29 to Dec 24 in intervals of 2 or 3 days
See attached for data and script and current graph format

채택된 답변

Star Strider
Star Strider 2022년 1월 3일
Perhaps something like this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/851315/collated_11.csv')
T1 = 6360×2 table
Datetime Light ________________ ______ 29/11/2021 12:05 413.6 29/11/2021 12:10 503.1 29/11/2021 12:15 1580.8 29/11/2021 12:20 1451.7 29/11/2021 12:25 1494.3 29/11/2021 12:30 1318.4 29/11/2021 12:35 1112.5 29/11/2021 12:40 913.4 29/11/2021 12:45 870.6 29/11/2021 12:50 1028.9 29/11/2021 12:55 1177.9 29/11/2021 13:00 1425.3 29/11/2021 13:05 2175.7 29/11/2021 13:10 1746.3 29/11/2021 13:15 1719 29/11/2021 13:20 1642.1
figure
plot(T1.Datetime, T1.Light)
grid
xlabel('Days')
ylabel('Light')
dl = datetime('29-Nov-2021');
dr = datetime('24-Dec-2021');
interval = days(2);
xtix = dl : interval : dr;
set(gca, 'XTick',xtix)
xlim([dl dr])
.
  댓글 수: 2
Sophia
Sophia 2022년 1월 4일
Sorted! Thank-you!
Star Strider
Star Strider 2022년 1월 4일
As always, my pleasure!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by