Hi,
I've been struggling with this issue for a few days and have searched through lots of Matlab documentation and am still struggling to find an answer.
Not sure of the protocol for providing code/files, but I have attached both in case and tried to simplify as much as possible.
TLDR: I have two datetime values that I know are equal, but when I try to compare them using '==' I get a logical of '0', meaning that they aren't being read as equal?
Long version: I have observed stream discharge data and simulated stream discharge data that are in tables in matlab. The observed data have gaps so the time steps are irregular, and only some times match up with the simulated data. Because of this, the two tables are also different lengths. I am trying to create a combined table where there is one time 't' variable (which is all of the occurrences where the observed and simulated data have the same times), and then a variable for the simulated discharge and a variable for the observed discharge. Since the tables are not the same length, I am trying to create the combined data by deleting any rows before or after the first and last matching time (this could be a problem though if there is missing data in between the start and end).
I used this code for another model previously and it worked completely fine, but I am now getting errors when I try to generate the combined data table. I decided to test to see if the values were reading as equal, so I tested the first matching time value between the two data sets and found that Matlab did not read them as equal (see below).
sim.t(25)
obs.t(46)
equaltest = sim.t(25)==obs.t(46)
ans =
datetime
03/24/17 09:05:00
ans =
datetime
03/24/17 09:05:00
equaltest =
logical
0
I can't tell if the issue with creating the combined data set is in my methods and code or if the issue is related to the datetime values not showing as equal when they really are?
Again, apologies that the question is a bit long- I wanted to make sure I provided enough info to help out whoever is kind enough to help answer my question!
0 Comments
Sign in to comment.