Outerjoin isn’t matching the same values in two different tables
Hi everyone! I’m having a problem with some datetime tables, and using outerjoin.
So I have this one matrix, that has all my data. The first column is the datetime, and the next columns are data matching each time (I haven’t included the data in the attached files, just the first column). The problem I’m having is that sometimes the datetime skips time – for instance, one row will be July 10 2023 18:00:00, and then the next row will be July 12 2023 0:00:00. This is just due to the nature of the data collection, but since I want to run some statistical analyses on my data, I want the timestep for the date and time to be even, even if that means between those two time steps I will have NaNs in all the data columns (since there was no data collected during that time).
So to do this I made a time vector that had an even time step from the beginning and the end of my data collection. I then tried to use outerjoin to join this dataset with the datetime column of my original dataset. However, I’m finding that they’re not matching up even when the date and time are the same in each dataset!
Here’s what I mean:
This is the output table from using the outerjoin function. On the left is my time vector with even time steps, and on the right is my data table that is messier with skips in date and time. As you can see, there are times where they match up (for example, row 574), but there are also times where they don’t (rows 577 and 578, where the values are the SAME but they’re not recognized as such).
How can I fix this? I made sure there are no repeats in either table I’m working with. I’ve also tried using outerjoin when the datetime is in the matlab number format, but I still have the same problem. I’m open to any solution, even if it doesn’t use outerjoin as a function. I just want an even timestep for my data.
I’ve attached my datasets: timevecTable is the time vector with even time steps, and v2Table is my dataset that skips datetimes. The resulting table using outerjoin is also included, and that’s named timeJoined.
Thank you!Hi everyone! I’m having a problem with some datetime tables, and using outerjoin.
So I have this one matrix, that has all my data. The first column is the datetime, and the next columns are data matching each time (I haven’t included the data in the attached files, just the first column). The problem I’m having is that sometimes the datetime skips time – for instance, one row will be July 10 2023 18:00:00, and then the next row will be July 12 2023 0:00:00. This is just due to the nature of the data collection, but since I want to run some statistical analyses on my data, I want the timestep for the date and time to be even, even if that means between those two time steps I will have NaNs in all the data columns (since there was no data collected during that time).
So to do this I made a time vector that had an even time step from the beginning and the end of my data collection. I then tried to use outerjoin to join this dataset with the datetime column of my original dataset. However, I’m finding that they’re not matching up even when the date and time are the same in each dataset!
Here’s what I mean:
This is the output table from using the outerjoin function. On the left is my time vector with even time steps, and on the right is my data table that is messier with skips in date and time. As you can see, there are times where they match up (for example, row 574), but there are also times where they don’t (rows 577 and 578, where the values are the SAME but they’re not recognized as such).
How can I fix this? I made sure there are no repeats in either table I’m working with. I’ve also tried using outerjoin when the datetime is in the matlab number format, but I still have the same problem. I’m open to any solution, even if it doesn’t use outerjoin as a function. I just want an even timestep for my data.
I’ve attached my datasets: timevecTable is the time vector with even time steps, and v2Table is my dataset that skips datetimes. The resulting table using outerjoin is also included, and that’s named timeJoined.
Thank you! Hi everyone! I’m having a problem with some datetime tables, and using outerjoin.
So I have this one matrix, that has all my data. The first column is the datetime, and the next columns are data matching each time (I haven’t included the data in the attached files, just the first column). The problem I’m having is that sometimes the datetime skips time – for instance, one row will be July 10 2023 18:00:00, and then the next row will be July 12 2023 0:00:00. This is just due to the nature of the data collection, but since I want to run some statistical analyses on my data, I want the timestep for the date and time to be even, even if that means between those two time steps I will have NaNs in all the data columns (since there was no data collected during that time).
So to do this I made a time vector that had an even time step from the beginning and the end of my data collection. I then tried to use outerjoin to join this dataset with the datetime column of my original dataset. However, I’m finding that they’re not matching up even when the date and time are the same in each dataset!
Here’s what I mean:
This is the output table from using the outerjoin function. On the left is my time vector with even time steps, and on the right is my data table that is messier with skips in date and time. As you can see, there are times where they match up (for example, row 574), but there are also times where they don’t (rows 577 and 578, where the values are the SAME but they’re not recognized as such).
How can I fix this? I made sure there are no repeats in either table I’m working with. I’ve also tried using outerjoin when the datetime is in the matlab number format, but I still have the same problem. I’m open to any solution, even if it doesn’t use outerjoin as a function. I just want an even timestep for my data.
I’ve attached my datasets: timevecTable is the time vector with even time steps, and v2Table is my dataset that skips datetimes. The resulting table using outerjoin is also included, and that’s named timeJoined.
Thank you! outerjoin, datetime MATLAB Answers — New Questions