joining two tables with two keys

9 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 6 月 13 日
コメント済み: alpedhuez 2020 年 6 月 14 日
I have two tables table 1 and table 2.
Table 1
day location expenses
1 Buckingham_Palace 1 million
1 Los_Angels 2 million
2 Los_Angels 1 million
2 New_York 1 million
Table 2
day location number_of_reporters
1 Los_Angels 300
2 Los_Angels 500
2 New York 100
Then I want to create table 3
day location expenses number of reporters
1 Buckingham_Palace 1 million
1 Los_Angels 2 million 300
2 Los_Angels 1 million 500
2 New_York 1 million 100
Please advise.
  2 件のコメント
Image Analyst
Image Analyst 2020 年 6 月 13 日
Did you try join(), and outerjoin()? I thought I've referred you to this link before, but maybe not. So, fix your post (attach your tables in a .mat file) AFTER you read that link.
alpedhuez
alpedhuez 2020 年 6 月 14 日
I think the problem is that the documetation
does not have an example using keys
'Keys' Variables to use as keys
positive integer | vector of positive integers | character vector | cell array of character vectors | string array | logical vector
Variables to use as keys, specified as the comma-separated pair consisting of 'Keys' and a positive integer, vector of positive integers, character vector, cell array of character vectors, string array, or logical vector.
You cannot use the 'Keys' name-value pair argument with the 'LeftKeys' and 'RightKeys' name-value pair arguments.
A vector of row labels can be a key, alone or in combination with other key variables. For more information, see the Tips section.
Example: 'Keys',[1 3] uses the first and third variables in Tleft and Tright as key variables.
Example: 'Keys',{'X','Y'} uses the variables named X and Y in Tleft and Tright as key variables.
Example: 'Keys','Row' uses the vectors of row names of Tleft and Tright as key variables, if both Tleft and Tright are tables with row names.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by