kostis
kostis

Reputation: 117

Merge 2 columns of two tables to a third one in Matlab

I have two tables for example

1 120
2 100
3 400
4 600

and

1  150
2  300
3  700
4  350

And I want to create a third table with the values

120   150
100   300
400   700
600   350

Any idea how can i achieve this?

Upvotes: 0

Views: 1487

Answers (2)

Oleg
Oleg

Reputation: 10676

If you have:

a = [1 120
     2 100
     3 400
     4 600];

and

b = [1  150
     2  300
     3  700
     4  350];

Then

c = [a(:,2) b(:,2)];

Upvotes: 2

yuk
yuk

Reputation: 19870

table3 = [table1(:,2) table2(:,2)];

Upvotes: 3

Related Questions