필터 지우기
필터 지우기

outerjoin using Row Names as key?

조회 수: 5 (최근 30일)
Anil
Anil 2016년 1월 6일
댓글: FM 2023년 1월 31일
The join operation supports table merging using the table row names as key (using the flag 'keys','RowNames'). This functionality doesn't appear to be available when using innerjoin or outerjoin? Is there a workaround for this (I'm currently considering creating a wrapper function that explicitly adds the rownames to a column in both tables, joins using the column, and then readds the rownames, but I feel this may be fairly slow?)

답변 (1개)

Peter Perkins
Peter Perkins 2016년 1월 6일
Row names have to be unique, so I think you're wanting to do something that might be described as more of a merge than a full-blown inner/outer join where there might be many-to-many matches. And if you have a one-to-one correspondence between the two tables, the join function does accept 'RowNames'. But you're correct, the inner/outerjoin functions don't support this directly.
Your idea of adding he row names as an explicit key var will work, I think you could do also use setdiff on the row names and then concatenation. Hope this helps.
  댓글 수: 1
FM
FM 2023년 1월 31일
For the sake of consistency and convenience, I wonder of TMW would add the ability to inner/outer join based on RowNames. It would certainly streamline the coding compared to having to add the variable and later to remove it.

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

카테고리

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