finding multiple datetime cells from a table
9 次查看(过去 30 天)
显示 更早的评论
Is there a way that I can find a week of data from a table by inputing only a starting date (2020/04/06) and finding the corresponding next 6 days
The table looks something like this:
126540 2020/04/06 00:08 0 5.7
126541 2020/04/06 00:23 0 6.9
126542 2020/04/06 00:38 0 8.2
126543 2020/04/06 00:53 0 8.9
126544 2020/04/06 01:19 1 11.0
126551 2020/04/06 02:23 0 10.6
126740 2020/04/07 05:16 0 10.9
126741 2020/04/07 05:39 1 10.9
126743 2020/04/07 05:31 0 11.2
126963 2020/04/08 10:24 0 14.6
126964 2020/04/08 10:39 0 14.4
etc.
And my code:
T = readtable('testdata.txt');
k = find(ismember(T.Var2,'2020/04/06')); %find the date
k2 = find(ismember(T.Var2,'2020/04/07'));
k3 = find(ismember(T.Var2,'2020/04/08'));
k4 = find(ismember(T.Var2,'2020/04/09'));
k5 = find(ismember(T.Var2,'2020/04/10'));
k6 = find(ismember(T.Var2,'2020/04/11'));
k7 = find(ismember(T.Var2,'2020/04/12'));
I need to extract all the rows within that week by just inputing the starting day of that week.
would be much appreciated with any help.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calendar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!