Why does Matlab enforce uniqueness in join
조회 수: 35 (최근 30일)
이전 댓글 표시
For example
table1 = table([1 1 2 2].', [0 0 0 0].');
table2 = table([1 1 2 2].', [1 1 1 1].');
table2.Properties.VariableNames{2} = 'Var3';
join(table1, table2)
we get:
>> join(table1, table2)
Error using table/join (line 111)
The key variable for B must have unique values.
I don't find this behaviour desirable as you are able to do a join when the key variables are not unique in SQL.
Is there a reason why MW decided to enforce this condition?
댓글 수: 0
답변 (2개)
the cyclist
2016년 4월 6일
댓글 수: 3
Matias Andina
2018년 6월 17일
I had a similar problem and solved it using
outerjoin(x, y, 'Type', 'Left', 'MergeKeys', true)
r r
2021년 5월 23일
The problem I used the same method and it appears to me NUN ???
T1 = readtable('R.txt','ReadVariableNames',false)
T2 = readtable('ShellE.txt','ReadVariableNames',false)
C=outerjoin(T1, T2, 'Type', 'Left', 'MergeKeys', true)
댓글 수: 1
Walter Roberson
2021년 5월 23일
You need to use 'LeftKeys' and 'RightKeys' because you are not joining on the variable names that are shared between them (such as 'Var1')
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!