Vertcat with equally sized tables does not work

I am trying to concatenate 2 tables that have the same size (8X3):
table_3 = vertcat(table_1 , table_2)
but I get the error message saying that:
Dimensions of Arrays being concatenated are not consistent.
Both tables have the same column names. When I try to concatenate table_1 with table_1 I don't have any issues:
table_3 = vertcat(table_1 , table_1)
Also, the other approach of vertac caues the same problem:
table_3 = [table_1; table2]

댓글 수: 1

Some further clarification. The error message points out that one particular variable that contains different lengths strings caused this issue.

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

 채택된 답변

KSSV
KSSV 2022년 3월 3일

0 개 추천

Try join.
table_3 = join(table_1 , table_2)

댓글 수: 4

That did not work, as it is trying to join them horizontally (error message is that it ican't find a commen variable to use as key)
KSSV
KSSV 2022년 3월 3일
Attach your tables...
Just guess....I suspect they are character array.
Convert to cell and back to table.
cell2table(vertcat(table2cell(table_1),table2cell(table_2)),'VariableNames',{'A','B','C'})
That worked, thank you so much Simon!!!

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2021a

질문:

2022년 3월 3일

댓글:

2022년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by