Select subset of dates
8 views (last 30 days)
Show older comments
I have data
T.date
T.temperature
T.date runs from January 1, 2019 to December 31, 2019.
I now want to subset the date from January 1, 2019 to June 31, 2019 and draw the plot of T.temperature on that subset of date. How should one write the code?
0 Comments
Accepted Answer
Ameer Hamza
on 23 May 2020
Something like this
start_date = datetime(2019, 1, 1);
end_date = datetime(2019, 6, 30);
idx = (start_date < T.date) & (T.date < end_date);
T_new = T(idx, :)
2 Comments
More Answers (0)
See Also
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!