Joining 2 tables to make 1 table

조회 수: 1 (최근 30일)
Sarah Yun
Sarah Yun 2019년 12월 14일
답변: Jesus Sanchez 2019년 12월 14일
Hello,
I have 2 tables. I want to join these tables together to make 1 table.
They have the same number of columns.
What code should I use to joint them?
Thank you.
  댓글 수: 2
Jesus Sanchez
Jesus Sanchez 2019년 12월 14일
Are you looking for a different behaviour not provided by table.join?
Sarah Yun
Sarah Yun 2019년 12월 14일
편집: Sarah Yun 2019년 12월 14일
Hello,
The end of the old table matches the start of the new table.
I just want to join the old and new tables together
The column names are slightly different for the old and new tables - does this matter?

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

채택된 답변

Jesus Sanchez
Jesus Sanchez 2019년 12월 14일
You can unite them as if they were matrixes:
complete_table = [table1 ; table2]; % This should work to join the columns of both tables

추가 답변 (1개)

Guillaume
Guillaume 2019년 12월 14일
Sounds like you merely want to vertically concatenate your two tables. The only problem is that they don't have the same variable names, so you'll have to rename the variables of one of them:
table_old.Properties.VariableNames = table_new.Properties.VariableNames; %rename variables in old table. Could do it the other way round
merged = [table_old; table_new]

카테고리

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