Cross product of two tables without common key
8 ビュー (過去 30 日間)
古いコメントを表示
Frederick Awuah-Gyasi
2022 年 5 月 21 日
コメント済み: Frederick Awuah-Gyasi
2022 年 5 月 23 日
tables 1
Name
A
B
C
table2
Number Count
1 0
2 0
3 0
4 0
I want
Name Number Count
A 1 0
A 2 0
A 3 0
A 4 0
B 1 0
B 2 0
B 3 0
B 4 0
C 1 0
C 2 0
C 3 0
C 4 0
I tried outer join but since there is not key between the two tables that failed. Any help. Thank you.
1 件のコメント
Star Strider
2022 年 5 月 22 日
This may not be at all relevant, however Three columns (x,y,z) in table, Loop through table for each X plot Y vs Z could tangetially be related to this post.
I have no idea if it is or what the desired results are.
採用された回答
その他の回答 (1 件)
dpb
2022 年 5 月 21 日
May be something more exotic, but I'd just build it from the pieces...
tT=[table(reshape(repmat(t1.Name,1,height(t2)).',[],1),'VariableNames',{'Name'}) repmat(t2,height(t1),1)]
tT =
12×3 table
Name Number Count
____ ______ _____
A 1 0
A 2 0
A 3 0
A 4 0
B 1 0
B 2 0
B 3 0
B 4 0
C 1 0
C 2 0
C 3 0
C 4 0
>>
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!