Clear Filters
Clear Filters

comparing the variables of values of two tables

29 views (last 30 days)
I am having the following problem, we have two tables t1 and t2 (an in the attachments), we would like to do the following comparison between them
  • - compare two dates values in the tables (using the variables t1.Date3 and t2.date2)., we extract only the matching rows and save them in another table.
  • -Then using the saved table we compare the minutes of the two times in the two tables, we choose the row were only the minutes from the second table falls within +-30mins of the minutes from the first table.
  • -Then we check if the f0f2 variable for the second table lies within a range of +-0.5 of the f0f2 variable in the first table. then again we remove any non matching rows from the table.
I started off by doing the follwoing but i am not sure if I am doing it in the right way,
%comparing the dates values from t1 and t2
[Lia2, Locb2] = ismember(t1.Date3, t2.date2);
indx2 = Locb2(Locb2 > 0);
%comparing the times of th two tables based on the minutes value
tf = isbetween(,tlower,tupper);
%comparing the f0F2 values

Answers (1)

Tala on 3 Apr 2022
Edited: Tala on 3 Apr 2022
are you sure there is any matching numbers in variables t1.Date3 and t2.date2? Lia2 is an array of 0!
Manar Anwar
Manar Anwar on 3 Apr 2022
I have change the attachement t2 to another table where I am sure there is a matching in the dates, but still lia2 is an array of 0, thats why I am not sure if I am doing things correctly
Tala on 4 Apr 2022
The values in t1.Date3 are identical and equal to 1.9961e+11! you can use
[row,~] = find(t2.date2==t1.Date3(1));
to find the rows that are equal to 1.9961e+11. The rows 57988,57989, 57990, 57991match t1.Date3. The Newt2 has only 4 rows.
I am not clear what you wanna do from this point. To my understaning, is a constant value for the most part as you can see below! adding 30 minutes to does not make sense to me :)

Sign in to comment.


Find more on Just for fun in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!