Vertcat with equally sized tables does not work

2 visualizaciones (últimos 30 días)
Metin Akyol
Metin Akyol el 3 de Mzo. de 2022
Comentada: Metin Akyol el 3 de Mzo. de 2022
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 comentario
Metin Akyol
Metin Akyol el 3 de Mzo. de 2022
Some further clarification. The error message points out that one particular variable that contains different lengths strings caused this issue.

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 3 de Mzo. de 2022
Try join.
table_3 = join(table_1 , table_2)
  4 comentarios
Simon Chan
Simon Chan el 3 de Mzo. de 2022
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'})
Metin Akyol
Metin Akyol el 3 de Mzo. de 2022
That worked, thank you so much Simon!!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by