From: maria giovanna dainotti on

Dear Mathgroup,
I need to join two table in which one column should be the same. And if it is not the same at the same position I would like to find the way that Math can match the column when for example the tenth column of the first table should be the same of the forth column of the second table.

AI could do also with a do operation but the lenght of the table can be also different.

Is there a more general method to figure out this problem?
for example with union Union[{DataFitend},{DataFitLx}]
it returns all the table instead I would like to eliminate one column that it is the same.
how can i do?
Thanks a lot
Maria

From: Nicola Mingotti on
On 2010-03-08 12:19:35 +0100, maria giovanna dainotti said:

> Dear Mathgroup,
> I need to join two table in which one column should be the same. And if=

> it is not the same at the same position I would like to find the way
> that Math can match the column when for example the tenth column of the=

> first table should be the same of the forth column of the second table.
>
> AI could do also with a do operation but the lenght of the table can be=

> also different.
>
> Is there a more general method to figure out this problem?
> for example with union Union[{DataFitend},{DataFitLx}]
> it returns all the table instead I would like to eliminate one column
> that it is the same.
> how can i do?
> Thanks a lot
> Maria

Hello,

I don't know if i understood well but the problem could be that what
you consider two "equal" list are not precisely the same.

1) In this case it works as expected
a = {{1, 2, 3}, {4, 5, 6}};
b = {{1, 2, 3}, {7, 8, 9}};
In[40]:= Union[a, b]
Out[40]= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}

2) in this case don't :
a = {{1.0, 2, 3}, {4, 5, 6}};
b = {{1, 2, 3}, {7, 8, 9}};
Union[a, b]

=> {{1, 2, 3}, {1., 2, 3}, {4, 5, 6}, {7, 8, 9}}

..... because 1 can be considered equal to 1.0 but even not, it depends on
how you define equality.


bye

nicola
From: Bob Hanlon on

data1 = Array[a, {5, 3}];

data2 = Array[b, {5, 6}] /. b[x_, 5] -> a[x, 3];

Transpose[DeleteDuplicates[Transpose[Join[data1, data2, 2]]]]


Bob Hanlon

---- maria giovanna dainotti <mariagiovannadainotti(a)yahoo.it> wrote:

=============

Dear Mathgroup,
I need to join two table in which one column should be the same. And if it is not the same at the same position I would like to find the way that Math can match the column when for example the tenth column of the first table should be the same of the forth column of the second table.

AI could do also with a do operation but the lenght of the table can be also different.

Is there a more general method to figure out this problem?
for example with union Union[{DataFitend},{DataFitLx}]
it returns all the table instead I would like to eliminate one column that it is the same.
how can i do?
Thanks a lot
Maria


From: Simon on
Of course it's possible... but I don't think that you'll get a one-
line solution.

Just test whether a subset of the second table's column matches part
of the first table's column. Find out how much you have to shift the
column to get it working and pad/truncate the two tables to get the
dimensions and alignment correct.
Hint: When padding/truncating it might be easier to transpose then pad/
truncate then transpose back.

If you post a simplified example, someone might even supply some code
for you.

Simon

On Mar 8, 7:19 pm, maria giovanna dainotti
<mariagiovannadaino...(a)yahoo.it> wrote:
> Dear Mathgroup,
> I need to join two table in which one column should be the same. And if i=
t is not the same at the same position I would like to find the way that Ma=
th can match the column when for example the tenth column of the first tabl=
e should be the same of the forth column of the second table.
>
> AI could do also with a do operation but the lenght of the table can be a=
lso different.
>
> Is there a more general method to figure out this problem?
> for example with union Union[{DataFitend},{DataFitLx}]
> it returns all the table instead I would like to eliminate one column tha=
t it is the same.
> how can i do?
> Thanks a lot
> Maria


From: dh on


by Identity and transpose rows back to columns. Here is an example:

On 08.03.2010 12:19, maria giovanna dainotti wrote:

E-Mail:<mailto:dh(a)metrohm.com>

Internet:<http://www.metrohm.com>