Remove datetime values from a table
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have two tables with datetime values in their respective .Var3 variable (the dates in file2/second image continues to 2023). So my question is:
How do I remove all dates from file2.Var3 that are not the dates in file1.Var3? So, I want to remove all dates from file2.Var3 that does not exist in file1.Var3, what's the easiest way to do that?
Please tell me if you need more information.
Thanks
file1
![file1](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1502019/file1.png)
file2
![file2](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1502024/file2.png)
채택된 답변
Voss
2023년 10월 4일
"I want to remove all dates from file2.Var3 that does not exist in file1.Var3"
I assume you mean to remove the rows from the table file2 where file2.Var3 does not exist in file1.Var3.
file2(~ismember(file2.Var3,file1.Var3),:) = [];
추가 답변 (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!