# I want to concate two tables vertically.the table has no variable name.how can I do that?

15 views (last 30 days)
Nixon Dhar on 28 Nov 2017
Answered: Peter Perkins on 29 Nov 2017
size of one table is 2*4(contains number) and another is 1*4(contains single charcter),bt ineed a table of 3*4 combining these two table.how?

Birdman on 28 Nov 2017
There is no fig
KL on 28 Nov 2017
Nixon Dhar on 28 Nov 2017
plz ans....

Birdman on 28 Nov 2017
Edited: Birdman on 28 Nov 2017
x=[1 2 3 4;6 7 3 4];
y=['A' 'B' 'C' 'D'];
x=reshape(char(string(x(:))),2,4);
Table=array2table([x;y])

Nixon Dhar on 28 Nov 2017
I mean x= 1 2 3 4
Y= A B C D
REQUIRED
1 2 3 4
A B C D
Birdman on 28 Nov 2017
x=[1 2 3 4];
y=['A' 'B' 'C' 'D'];
x=reshape(char(string(x(:))),1,4);
Table=array2table([x;y])

Jan on 28 Nov 2017
T1 = array2table([1,2,3,4; 5,6,7,8]);
T2 = array2table('ABCD')
C12 = [table2cell(T1); table2cell(T2)];
T12 = array2table(C12)
Mh, I'm not convinced. There should be a way without a conversion to a cell. But:
T12 = [T1; T2]
sets the values of the numbers to empty matrices.

Nixon Dhar on 28 Nov 2017
it works well,real.size s 4356*400,bt when I want to see the table,it taking too much time,why??
Jan on 28 Nov 2017
What exactly is "too much"? You can use the profiler to find out, where the time is spent.

Peter Perkins on 29 Nov 2017
The problem here is that the requirement of two rows that are numbers and one row that is text is exactly the opposite orientation that tables are designed for. So Jan's solution creates what is essentially one 3x4 cell array, with numbers in some cells and text in others, while cvklpstunc's solution turns the numbers into text.
I'm guessing that this is all about display, not about creating a table for manipulating data. If you were storing those data, you'd want to do it like this:
>> x = [1 2 3 4;6 7 3 4];
>> y = ['A' 'B' 'C' 'D'];
>> t = table(x(1,:)', x(2,:)', y')
t =
4×3 table
Var1 Var2 Var3
____ ____ ____
1 6 A
2 7 B
3 3 C
4 4 D
Jan's solution ends up displaying something like
T12 =
3×4 table
C121 C122 C123 C124
____ ____ ____ ____
[1] [2] [3] [4]
[5] [6] [7] [8]
'A' 'B' 'C' 'D'
which probably is not desirable for display.