Join two tables MATLAB

2 views (last 30 days)
sc1991
sc1991 on 21 Feb 2019
Edited: per isakson on 22 Feb 2019
Hello everyone, I have two tables with different headers (mostly) and have 2-3 headers in common. I want to use one header which is the time column(not in datetime format). to join the two tables. My problem is that there are few places where both tables have values for the same time insatnce and then there are places where they dont have any values corresponding to each other time instances. Can any one suggest how can I make them as one table with showing all the variables from Table 1 and Table 2 as well shwing the data for common time stamp and filling the rest data in where they dont match each other time stamp with NaN's.
I tried using join but it keeps telling me that I have to have unique data points I also tried union but that will require me to have same headers and I did add same headers by introducing NaN data under the new column headers(introduced in both the tables) but then again as I said earlier that for few time stamp which is common to both I have data I am missing those as I am adding NaN to the whole set to match the length of each table.
Can any one suggest me wat approach I could use.
Also as a note I cant convert my time column to datetime as it has a wired formating.
Please, let me know wat your suggestion are.

Accepted Answer

Peter Perkins
Peter Perkins on 21 Feb 2019
Isn't outerjoin what you are looking for? It will give you one table with rows that match, rows that are only in the left, and rows that are only in the right.
Also, your times would have to have very weird formatting indeed to not be convertable to datetime. What do you have exactly?

More Answers (0)

Community Treasure Hunt

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

Start Hunting!