How can I make this line start from a specific date?

조회 수: 1 (최근 30일)
Pul
Pul 2021년 9월 4일
편집: Pul 2021년 9월 5일
Hello everyone,
How can I make the magenta line start from a specific date (14 Jan 2015) in the graph, instead of 1 Jan 1998?
% Lv = DTv <= datetime('7-Jan-2020');
Thank you!

채택된 답변

Star Strider
Star Strider 2021년 9월 4일
Change ‘Lv’ to:
Lv = (DTv <= datetime('7-Jan-2020')) & (DTv >= datetime('14-Jan-2015'));
and it should do what you want.
Consider adding:
xlim([min(DTv(Lv)) max(DTv(Lv))])
after the plot calls that use ‘DTv’ to restrict the x-axis limits. This is not required, however it would avoid whitespace at the ends of the plots.
.
  댓글 수: 6
Pul
Pul 2021년 9월 5일
Yes, perfect.
Thank you!
Star Strider
Star Strider 2021년 9월 5일
As always, my pleasure!
.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by