Extract data corresponding to particular dates
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2022-11-19
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,:)
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!