Got error in joining two tables: Left and right key variables 'Date' and 'Date' include cells containing non-string values.

23 ビュー (過去 30 日間)
JFz
JFz 2017 年 12 月 20 日
コメント済み: JFz 2017 年 12 月 22 日
Hi, I have two tables a and b. Both have a column Date as datenum. When I use left join, I got this error: "Left and right key variables 'Date' and 'Date' include cells containing non-string values." One table has 600 records; the other table is very large and has 25000 records. What can be the problem here and how to fix this?
Thanks for any input.
  2 件のコメント
KL
KL 2017 年 12 月 20 日
what is left join?
JFz
JFz 2017 年 12 月 20 日
I am using outerjoin:
outerjoin(a,b,'Type','left','MergeKeys',true);

サインインしてコメントする。

回答 (1 件)

Peter Perkins
Peter Perkins 2017 年 12 月 22 日
The error seems clear: you are trying to use a variable that is not supported as a key. You say that you have a datenum variable, the error suggests that that is not the case, that you have a cell array containing datenums.
If you are using anything like a recent version of MATLAB, you will likely be better of using datetimes.
  1 件のコメント
JFz
JFz 2017 年 12 月 22 日
Thanks. I found out what the problem was: The keys were arrays of cells. I converted the cell array into array of doubles. I will post the answer soon.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by