필터 지우기
필터 지우기

Tables: Left Outer Join without changing key names

조회 수: 18 (최근 30일)
Christoph
Christoph 2015년 11월 25일
댓글: Christoph 2015년 11월 26일
Suppose I have two tables:
a = table({'a';'b';'c';'d'},[1;2;3;4],'VariableNames',{'Key','Var1'});
b = table({'a';'c';'e'},[0.1;0.2;0.3],'VariableNames',{'Key','Var2'});
And I do a left outer join:
c = outerjoin(a,b,'Type','left');
This will give me a table with variables 'Key_a', 'Var1', 'Key_b', 'Var2'
But what I would like to have would be a table with only 'Key', 'Var1', 'Var2'
Is there a simple way to do this via option settings, without having to rename manually? For me this would be a hassle, because I have tables with 7+ keys with dynamic names.

채택된 답변

Kirby Fears
Kirby Fears 2015년 11월 25일
Tell outerjoin to merge the keys.
c = outerjoin(a,b,'Type','left','MergeKeys',true);
  댓글 수: 1
Christoph
Christoph 2015년 11월 26일
Great, exactly what I was looking for, thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by