Extract data corresponding to particular dates
1 view (last 30 days)
Show older comments
Sayantan Sahu
on 18 Nov 2022
Commented: Star Strider
on 19 Nov 2022
I have csv file that contains a variable data every minute along with datetime in the format '2019-01-01 00:00'.
I want to select all data corresponding to particular dates say 12th Jan, 19th Jan, 24th March.
I imported the csv file using readtable and then converted it to timetable. However I am not sure how to select all data corresponding to particular dates. Every selected day should contain 24x60 data values.
0 Comments
Accepted Answer
Star Strider
on 19 Nov 2022
Therea re likely several ways to do this.
DT = table(datetime('now')+days(0:364).', 'VariableNames',{'DateTime'});
Data = array2table(randn(365,4));
T1 = [DT Data]
[y,m,d] = ymd(T1.DateTime);
query = [1 12; 1 19; 3 24];
Lv = ismember([m d], query, 'rows');
Result = T1(Lv,:)
.
2 Comments
More Answers (0)
See Also
Categories
Find more on Dates and Time 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!