Intersection(A,B) not working for date
1 次查看(过去 30 天)
显示 更早的评论
I have A and B date vectors. I want to extract the common dates from both. I used:
[C,ia, ib]=intersection(A,B)
But it is giving me extremely few results than expected. Any solution?
0 个评论
采纳的回答
Ingrid
2015-6-2
you should use a round before using using intersection to avoid floats not being equal to each other. If the dates are distinguishably by day (i.e. no hours given) you could use this
[C,ia, ib]=intersection(round(A),round(B))
1 个评论
更多回答(1 个)
Star Strider
2015-6-2
Since date vectors are row vectors, use the 'rows' option with intersect:
[C,ia, ib]=intersect(A,B,'rows');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!