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

4 vues (au cours des 30 derniers jours)
Justin Berquist
Justin Berquist le 3 Mai 2016
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 commentaires
CS Researcher
CS Researcher le 3 Mai 2016
join is to merge two tables. How do A and B look? Can you share them?
Justin Berquist
Justin Berquist le 4 Mai 2016
Modifié(e) : Walter Roberson le 4 Mai 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

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 3 Mai 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 commentaires
Justin Berquist
Justin Berquist le 4 Mai 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by