I would like to use the join function to align timestrings, is this possible?

4 views (last 30 days)
I keep getting an error message when I try to combine two 2 column matrices, one of these columns are timestrings and the other various temperatures. The error is
Undefined function 'join' for input arguments of type 'double'.
Error in Untitled (line 7) C = join(A,B)
The timestrings are occuring at a different frequency for the two matrices, does this effect things?
Thank you for your help
  2 Comments
Justin Berquist
Justin Berquist on 4 May 2016
Edited: Walter Roberson on 4 May 2016
They are big tables, but I can share some of the data for an example..
Matlab Time Number Presence [0 or 1]
7.3642e+05 1
7.3642e+05 1
7.3642e+05 1
7.3642e+05 0
7.3642e+05 0
7.3642e+05 0
Matlab Time Number Room Temperature
7.3652e+05 24.3656
7.3652e+05 24.3656
7.3652e+05 24.3656
7.3652e+05 24.1740
7.3652e+05 24.1740
7.3652e+05 24.1740

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 3 May 2016
As CS Researcher indicates, join is for table object. You could convert your arrays to tables and join() those.
But remember that join is going to look for exact equality in entries, and if your timestamps are numeric there is a possibility that the the last bit or two of two seemingly equal timestamps might not match. If you are using R2014b or later, it would be better to read the data into tables directly using readtable, having it convert the external timestamps into datetime objects.
If you need interpolation between the two tables, that the entries are to be matched by "nearest" timestamp or something like that, then you need a different strategy, involving first deciding on the time stamps desired for the joined data, and then interpolating one or both arrays to the target timestamp and then combining the two.
  2 Comments
Justin Berquist
Justin Berquist on 4 May 2016
Using the readtable function allows me to use the join function, thank you for that suggestion. If the tables are of different size am I able to use the join function and have some cells be left blank (cause a match doesn't exist) or does each have to be perfectly aligned?
Thank you again

Sign in to comment.

Categories

Find more on Characters and Strings 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!