comparing datetime objects between two tables.
10 views (last 30 days)
Show older comments
I would like to edit my question to this:
if we have two tables t1 and t2, both of them have a date variable. t2 have another variable say var2 that we would like to do the following with:
if we compare the dates between t1 & t2 and any matching is found then we would copy the value of var2 corrseponding to that date from t2 and add it to t1. How can we do that?
thaks for giving it a look.
0 Comments
Answers (1)
C B
on 15 Oct 2021
date1 = datetime('today');
date2 = datetime('yesterday');
date3 = datetime('tomorrow');
date4 = datetime('tomorrow');
date1 == date2
date3 == date4
date3 == date4 && date1 ~= date2
Above Logic is working fine can you share some content of your code like below.
Before if loop print all the variable and send in comment here so that i can have loook
year(currTable.Date)
year(S.date(j))
month(currTable.Date)
month(S.date(j))
day(currTable.Date)
day(S.date(j))
booleanMatrix
if ((year(currTable.Date)==year(S.date(j)) ...
&& month(currTable.Date)==month(S.date(j)) ...
&& day(currTable.Date)==day(S.date(j)) )==booleanMatrix)
%store the value of the variable 'F10_7' accured in that date from
%'S' into currTable
t.flux=S.F10_7(j);
end
3 Comments
See Also
Categories
Find more on Calendar 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!