plot for a part of x

3 views (last 30 days)
alpedhuez
alpedhuez on 11 Jul 2020
Answered: Star Strider on 11 Jul 2020
I have a plot for the date from 2001 to 2020. I now just want to plot for the data between 2019 and 2020. What will be a simpler way to do this?

Accepted Answer

Star Strider
Star Strider on 11 Jul 2020
Experiment witth this example:
dt = datetime([2001 01 01])+calmonths(0:(2021-2001)*12); % ‘datetime’ Vector
y = rand(size(dt)); % Random Vector
figure
plot(dt,y)
xlim([datetime([2019 01 01]) datetime([2020 12 31])]) % Define Plot Limits
.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!