Hi, I'm going to explain my problem with a small example of my real problem. My real problem has a bigger size than the following example.
I have two tables with data: Table1_example:
Table2_example:
Table1_example1 and Table1_example2 are the same variables that Table2_example1 and Table2_example2 (Categorical data).
I want to search the values in Table1_example in Table2_example and obtein the following final table:
TableObjective_example:
Thank you for your help.

댓글 수: 1

I try to use the function join but I have an error:
Error using table/join (line 111)
The key variable for B must have unique values.

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

답변 (1개)

Peter Perkins
Peter Perkins 2016년 8월 3일

0 개 추천

I'm not 100% sure I've understood the operation you want to do, but it sounds like you want to find the rows in table 2 whose example1 and example2 values match the example1 and example2 values in table 1, and get those rows from table 2. You can do that using something like
i = ismember(table2(:,{'example1' 'example2'}),table1(:,{'example1' 'example2'});
table3 = table2(i,:);
That assumes all combinations are unique. If the goal is more general than that, then I think Manuel is on the right track with some form of join.

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2016년 6월 20일

답변:

2016년 8월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by