Effacer les filtres
Effacer les filtres

Remove datetime values from a table

1 vue (au cours des 30 derniers jours)
Marcus Johnson
Marcus Johnson le 4 Oct 2023
Commenté : Voss le 4 Oct 2023
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
file2
file2

Réponse acceptée

Voss
Voss le 4 Oct 2023
"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),:) = [];
  2 commentaires
Marcus Johnson
Marcus Johnson le 4 Oct 2023
Yeah, that's what I meant. Thanks!
Voss
Voss le 4 Oct 2023
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by